summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2013-03-19 13:14:16 (GMT)
committerTorsten Grote <grote@kolabsys.com>2013-03-19 13:14:16 (GMT)
commit37e3efce46f46cf747b6444a7a9dbe1868457a67 (patch)
treeadfbf1a243d0f744a5221abf1264f92cfe696d1a
parenta7175cdda55ba1ca767541aabe452d892a470650 (diff)
downloadkolab.org-www-37e3efce46f46cf747b6444a7a9dbe1868457a67.tar.gz
add socialshareprivacy module
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/LICENSE.txt339
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/README.txt48
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/css/reset.css20
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/images/dummy_facebook.pngbin0 -> 1067 bytes
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.admin.inc304
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.info13
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.install175
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.module607
8 files changed, 1506 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/LICENSE.txt b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/LICENSE.txt
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/README.txt b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/README.txt
new file mode 100644
index 0000000..442ba7a
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/README.txt
@@ -0,0 +1,48 @@
+Drupal Social Share Privacy is packaged for download at http://drupal.org/project/socialshareprivacy.
+
+CHANGELOG
+*********
+
+v 7.x-1.1
+- added this README
+
+
+
+INSTALLATION
+************
+
+Normally install this module into your drupal.
+One more step is required, as the jQuery Plugin is not packaged in this module.
+
+So download it from here: http://www.heise.de/extras/socialshareprivacy/
+(choose the .zip or .tar.gz file)
+http://www.heise.de/extras/socialshareprivacy/jquery.socialshareprivacy.zip
+http://www.heise.de/extras/socialshareprivacy/jquery.socialshareprivacy.tar.gz
+
+Then extract this file in the folder sites/all/libraries/ of your installtion.
+You'll endup having a seperate folder named socialshareprivacy,
+where (at least) these two files have to exists:
+jquery.socialshareprivacy.js
+jquery.socialshareprivacy.min.js
+plus the another folder socialshareprivacy (again), with the
+socialshareprivacy.css
+file and the images folder.
+
+The first socialshareprivacy folder can be named as prefered,
+this is setable in this module's configuration, here: admin/config/system/socialshareprivacy
+
+
+
+CONFIGURATION
+*************
+
+Besides the library location there are other configuration options.
+F.e. the apperance of a media (facebook, twitter, google).
+The Perma Option means the checkboxes to make the deciscion to keep one media always on.
+
+I recommend to go to the settingspage and hit at least save once ..
+
+POSITIONING
+***********
+
+There is automatically a block created, wich can be used for positioning the HTML. \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/css/reset.css b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/css/reset.css
new file mode 100644
index 0000000..6e08dca
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/css/reset.css
@@ -0,0 +1,20 @@
+ul.social_share_privacy_area{
+ list-style-image: none;
+}
+
+.social_share_privacy_area li.settings_info .settings_info_menu form fieldset{
+ top: 0;
+ display: block;
+ background: none;
+}
+
+.social_share_privacy_area li.settings_info .settings_info_menu form fieldset legend {
+ position: relative;
+ height: 100%;
+ left: 0;
+ text-indent: 0;
+ top: 0;
+ display: block;
+ background: none;
+ border: none;
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/images/dummy_facebook.png b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/images/dummy_facebook.png
new file mode 100644
index 0000000..969be88
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/images/dummy_facebook.png
Binary files differ
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.admin.inc b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.admin.inc
new file mode 100644
index 0000000..43e80bc
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.admin.inc
@@ -0,0 +1,304 @@
+<?php
+/**
+ * @file
+ * Administration settings form area for Social Share Privacy module
+ */
+
+require_once(drupal_get_path('module', 'socialshareprivacy') . '/socialshareprivacy.install');
+
+ /**
+ * General configuration form for controlling the behaviour.
+ */
+function socialshareprivacy_admin_settings() {
+ $form = array();
+
+ $socialshareprivacy_path = _socialshareprivacy_get_path();
+
+ $form['socialshareprivacy_path'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Path'),
+ '#default_value' => $socialshareprivacy_path,
+ '#description' => t('The location the socialSharePrivacy plugin is installed in. Use a path relative to the Drupal root directory.'),
+ '#after_build' => array('_socialshareprivacy_admin_settings_check_plugin_path'),
+ );
+
+ $form['socialshareprivacy_services'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Enabled services'),
+ '#default_value' => variable_get('socialshareprivacy_services', unserialize(SOCIALSHAREPRIVACY_DEFAULT_VALUE_SERVICES)),
+ '#options' => array(
+ 'facebook' => 'Facebook',
+ 'twitter' => 'Twitter',
+ 'gplus' => 'Google+',
+ ),
+ );
+
+ $form['socialshareprivacy_services_permaoption'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Enabled permanent options'),
+ '#description' => t('Enabling this option for a social network means that the user gets an option to enable permanent data transfer to the corresponding network, thus reverting to the non-privacy 1-click sharing workflow.'),
+ '#default_value' => variable_get('socialshareprivacy_services_permaoption', unserialize(SOCIALSHAREPRIVACY_DEFAULT_VALUE_SERVICES)),
+ '#options' => array(
+ 'facebook' => 'Facebook',
+ 'twitter' => 'Twitter',
+ 'gplus' => 'Google+',
+ ),
+ );
+
+ $form['socialshareprivacy_facebook_action'] = array(
+ '#type' => 'radios',
+ '#title' => t('Facebook button action'),
+ '#options' => array(
+ 'recommend' => t('Recommend'),
+ 'like' => t('Like'),
+ ),
+ '#default_value' => variable_get('socialshareprivacy_facebook_action', 'recommend'),
+ );
+
+ $form['socialshareprivacy_ext_link'] = array(
+ '#type' => 'radios',
+ '#title' => t('External link (info icon)'),
+ '#default_value' => variable_get('socialshareprivacy_ext_link', ''),
+ '#options' => array(
+ '' => t('Open the link in the current window.'),
+ 'blank' => t('Open the link in a new window.'),
+ 'remove' => t('Remove the click event of the link.'),
+ ),
+ );
+
+ $form['socialshareprivacy_ext_link_target'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Change default info link'),
+ '#description' => t('If you do not want the info icon to link to the original explanatory page at heise.de you can override the target by specifying a URL here.'),
+ '#default_value' => variable_get('socialshareprivacy_ext_link_target', 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html'),
+ );
+
+ $form['socialshareprivacy_js_minified'] = array(
+ '#type' => 'radios',
+ '#title' => t('Use minified javascript file'),
+ '#options' => array(
+ 'true' => t('Yes'),
+ 'false' => t('No'),
+ ),
+ '#default_value' => variable_get('socialshareprivacy_js_minified', 'true'),
+ );
+
+ $form['socialshareprivacy_reset_css'] = array(
+ '#type' => 'radios',
+ '#title' => t('Include reset.css'),
+ '#options' => array(
+ 'true' => t('Yes'),
+ 'false' => t('No'),
+ ),
+ '#default_value' => variable_get('socialshareprivacy_reset_css', 'false'),
+ );
+
+ $form['socialshareprivacy_force_german'] = array(
+ '#type' => 'radios',
+ '#title' => t('Ignore Drupal\'s translations and use the original German texts from the plugin.'),
+ '#options' => array(
+ 'true' => t('Yes'),
+ 'false' => t('No'),
+ ),
+ '#default_value' => variable_get('socialshareprivacy_force_german', 'false'),
+ );
+
+ $form['socialshareprivacy_neutral_button'] = array(
+ '#type' => 'radios',
+ '#title' => t('Use language-neutral Facebook button'),
+ '#options' => array(
+ 'true' => t('Yes'),
+ 'false' => t('No'),
+ ),
+ '#default_value' => variable_get('socialshareprivacy_neutral_button', 'false'),
+ );
+
+ $form['socialshareprivacy_cookie_expires'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Cookie expiration time'),
+ '#description' => t('Cookie expiration time in days.'),
+ '#default_value' => variable_get('socialshareprivacy_cookie_expires', '365'),
+ );
+
+ $form['socialshareprivacy_referrertrack'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Tracking parameter'),
+ '#description' => t('The tracking parameter will be added to the end of the URL which is useful for tracking the referrer.'),
+ '#default_value' => variable_get('socialshareprivacy_referrertrack', ''),
+ );
+
+ return system_settings_form($form);
+}
+
+function socialshareprivacy_admin_fieldmgmt() {
+
+ if (!module_exists('field_ui')) {
+ drupal_set_message(t('Enable the Field UI module to adjust the Social Share Privacy field settings, manage node fields or manage the display.'), 'warning');
+ }
+
+ $ret[] = array('#markup' => t('Enable/Disable the Socialshareprivacy field for your content types (disabling will delete the data for all nodes of the content type):<br/>'));
+ $ret[] = drupal_get_form('socialshareprivacy_form_admin_fieldmgmt');
+ return $ret;
+}
+
+function socialshareprivacy_form_admin_fieldmgmt($form, &$form_state) {
+ $form = array();
+
+ $head = array(
+ 'contenttype' => array('data' => t('Content types'), 'field' => 'contenttype'),
+ );
+
+ $options = array();
+ $default_values = array();
+ foreach (node_type_get_names() as $name => $value) {
+ $options['ssp_fieldmgmt_' . $name] = array(
+ 'contenttype' => array(
+ 'data' => array(
+ '#type' => 'link',
+ '#title' => $value,
+ '#href' => 'admin/structure/types/manage/' . $name . '/fields',
+ ),
+ ),
+ );
+ $is_enabled = 0;
+ if (field_info_instance('node', variable_get('socialshareprivacy_field_name'), $name)) {
+ $is_enabled = 1;
+ }
+ $default_values['ssp_fieldmgmt_' . $name] = $is_enabled;
+ }
+
+ $form['ssp_fieldmgmt'] = array(
+ '#type' => 'tableselect',
+ '#header' => $head,
+ '#options' => $options,
+ '#default_value' => $default_values,
+ '#empty' => t('No content available.'),
+ );
+
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save'),
+ );
+
+ return $form;
+}
+
+function socialshareprivacy_form_admin_fieldmgmt_submit($form, &$form_state) {
+ $form_values = $form_state['values'];
+ $ssp_fieldmgmt = $form_values['ssp_fieldmgmt'];
+ $entity = 'node';
+ foreach ($ssp_fieldmgmt as $k => $v) {
+ if ($v===0) { // this means checked ..
+ __remove_custom_field($entity, drupal_substr($k, 14));
+ }
+ else {
+ __add_custom_field($entity, drupal_substr($k, 14));
+ }
+ }
+
+ drupal_set_message(t('The configuration options have been saved.'));
+}
+
+function socialshareprivacy_admin_bulkupdate() {
+
+ $ret[] = array('#markup' => t('Update the Socialshareprivacy boolean for existing nodes:<br/>Nothing to select? !url.<br/>', array('!url' => l(t('Enable a content type'), 'admin/config/user-interface/socialshareprivacy/fieldmgmt'))));
+ $ret[] = drupal_get_form('socialshareprivacy_form_admin_bulk');
+ return $ret;
+}
+
+function socialshareprivacy_form_admin_bulk($form, &$form_state) {
+ $form = array();
+
+ $head = array(
+ 'contenttype' => array('data' => t('Content types'), 'field' => 'contenttype'),
+ );
+
+ $options = array();
+ $options['none'] = 'none';
+ foreach (node_type_get_names() as $name => $value) {
+ if (field_info_instance('node', variable_get('socialshareprivacy_field_name'), $name)) {
+ $options[$name] = $value;
+ }
+ }
+
+ $form['ssp_bulkupdate_type'] = array(
+ '#type' => 'select',
+ '#title' => t('Please choose a content type'),
+ '#options' => $options,
+ '#default_value' => 'none',
+ );
+
+ $options = array();
+ $options[LANGUAGE_NONE] = t('Undetermined');
+ foreach (language_list() as $obj) {
+ $options[$obj->language] = $obj->native;
+ }
+ $form['ssp_bulkupdate_langs'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Please choose the desired languages'),
+ '#options' => $options,
+ );
+
+ $form['ssp_bulkupdate_value'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Enable SSP'),
+ '#description' => t('If this box is checked then SSP will be enabled on the chosen nodes, otherwise it will be disabled.'),
+ );
+
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Update'),
+ );
+
+ return $form;
+}
+
+function socialshareprivacy_form_admin_bulk_submit($form, &$form_state) {
+ $form_values = $form_state['values'];
+ $contenttype = $form_values['ssp_bulkupdate_type'];
+ $valuetoset = $form_values['ssp_bulkupdate_value'];
+ if ($valuetoset=='') {
+ $valuetoset = '0';
+ }
+ $lang_choosen = FALSE;
+ $langs = $form_values['ssp_bulkupdate_langs'];
+ foreach ($langs as $lang => $value) {
+ if ($lang==$value) {
+ $lang_choosen = TRUE;
+ }
+ }
+
+ if ($contenttype!='none' && $lang_choosen) {
+ $node_type = 'page'; // Machine name of the content type
+ $entity = 'node';
+
+ $query = new EntityFieldQuery;
+ $result = $query
+ ->entityCondition('entity_type', $entity)
+ ->propertyCondition('type', $contenttype)
+ ->execute();
+
+ if (!empty($result['node'])) {
+ $nodes = entity_load('node', array_keys($result['node']));
+
+ foreach ($nodes as $node) {
+ foreach ($langs as $lang => $value) {
+ if ($lang == $value) {
+ $node->field_socialshareprivacy[$lang][0]['value'] = $valuetoset;
+ }
+ }
+ node_save($node);
+ }
+ }
+ drupal_set_message(t('The nodes of type "@contenttype" have been updated.', array('@contenttype' => $contenttype)));
+ }
+ else {
+ if ($contenttype=='none') {
+ drupal_set_message(t('Please choose a content type.'), 'error');
+ }
+
+ if (!$lang_choosen) {
+ drupal_set_message(t('Please choose at least one language.'), 'error');
+ }
+ }
+} \ No newline at end of file
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.info b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.info
new file mode 100644
index 0000000..56b2da3
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.info
@@ -0,0 +1,13 @@
+name = socialSharePrivacy
+description = A two-click extension to social network sharing
+core = 7.x
+
+configure = admin/config/user-interface/socialshareprivacy
+
+
+; Information added by drupal.org packaging script on 2012-11-26
+version = "7.x-1.10"
+core = "7.x"
+project = "socialshareprivacy"
+datestamp = "1353933845"
+
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.install b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.install
new file mode 100644
index 0000000..a889dd0
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.install
@@ -0,0 +1,175 @@
+<?php
+
+/**
+ * @file
+ * Install/uninstall file for socialSharePrivacy module
+ */
+
+/**
+ * Implement hook_field_schema().
+ */
+function socialshareprivacy_field_schema($field) {
+ $columns = array(
+ 'value' => array('type' => 'int', 'default' => 0, 'not null' => FALSE),
+ );
+ return array('columns' => $columns, 'indexes' => array());
+}
+
+/**
+ * Implements hook_install().
+ */
+function socialshareprivacy_install() {
+ variable_set('socialshareprivacy_field_name', 'field_socialshareprivacy');
+ variable_set('socialshareprivacy_field_type', 'ssp_placeholder');
+ variable_set('socialshareprivacy_formatter', 'ssp_node_formatter');
+ variable_set('socialshareprivacy_widget', 'ssp_widget');
+}
+
+/**
+ * Implements hook_disable().
+ *
+ * put an message only.
+ */
+function socialshareprivacy_disable() {
+ drupal_set_message(t('Social share privacy: disabled. The field will remain until uninstalled.'));
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function socialshareprivacy_uninstall() {
+
+ $ssp_field_name = variable_get('socialshareprivacy_field_name');
+ if (field_read_field($ssp_field_name)) {
+ foreach (node_type_get_names() as $name => $value) {
+ __remove_custom_field('node', $name);
+ }
+ field_delete_field($ssp_field_name); // is needed because of core bug
+ field_purge_batch(2000);
+ }
+
+ variable_del('socialshareprivacy_services');
+ variable_del('socialshareprivacy_services_permaoption');
+ variable_del('socialshareprivacy_ext_link');
+ variable_del('socialshareprivacy_ext_link_target');
+ variable_del('socialshareprivacy_js_minified');
+ variable_del('socialshareprivacy_facebook_action');
+ variable_del('socialshareprivacy_cookie_expires');
+ variable_del('socialshareprivacy_referrertrack');
+ variable_del('socialshareprivacy_force_german');
+ variable_del('socialshareprivacy_field_name');
+ variable_del('socialshareprivacy_formatter');
+ variable_del('socialshareprivacy_widget');
+ variable_del('socialshareprivacy_field_type');
+ variable_del('socialshareprivacy_neutral_button');
+
+ drupal_set_message(t('Social share privacy: deleted field and variables'));
+}
+
+/**
+ * Implements hook_update_N().
+ *
+ * Deletes existing socialshareprivacy fields.
+ */
+function socialshareprivacy_update_7002() {
+ $ssp_field_name = 'field_socialshareprivacy';
+ // Sets the new variables
+ variable_set('socialshareprivacy_field_name', $ssp_field_name);
+ variable_set('socialshareprivacy_field_type', 'ssp_placeholder');
+
+ variable_set('socialshareprivacy_formatter', 'ssp_node_formatter');
+
+ variable_set('socialshareprivacy_widget', 'ssp_widget');
+ if (field_read_field($ssp_field_name)) {
+ foreach (node_type_get_names() as $name => $value) {
+ __remove_custom_field('node', $name);
+ }
+ field_delete_field($ssp_field_name); // is needed because of core bug
+ field_purge_batch(2000);
+ }
+ drupal_set_message(check_plain(t('Please check the new !settingslink field settings.',
+ array('!settingslink' => l(t('Social share privacy'), 'admin/config/user-interface/socialshareprivacy/fieldmgmt'))
+ )), 'warning'
+ );
+ return t('Existing socialshareprivacy fields deleted.');
+}
+
+function __add_custom_field($entity, $bundle) {
+
+ $t = get_t();
+ $ssp_field_name = variable_get('socialshareprivacy_field_name', 'field_socialshareprivacy');
+ // Clear the field cache to be sure the new field type is available.
+ field_cache_clear();
+
+ if (!field_info_field($ssp_field_name)) {
+ $field = array(
+ 'field_name' => $ssp_field_name,
+ 'module' => 'socialshareprivacy',
+ 'no_ui' => TRUE,
+ 'settings' => array(
+ 'allowed_values' => array(
+ 0 => 'hidden',
+ 1 => 'shown',
+ ),
+ 'allowed_values_function' => '',
+ ),
+ 'type' => SOCIALSHAREPRIVACY_FIELD_TYPE,
+ );
+ field_create_field($field);
+ }
+
+ if (!field_info_instance($entity, $ssp_field_name, $bundle)) {
+ $instance = array();
+ $instance = array(
+ 'bundle' => $bundle,
+ 'default_value' => array(
+ 0 => array(
+ 'value' => 1,
+ ),
+ ),
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'hidden',
+ 'module' => 'socialshareprivacy',
+ 'settings' => array(),
+ 'type' => SOCIALSHAREPRIVACY_FORMATTER,
+ 'weight' => 20,
+ ),
+ 'teaser' => array(
+ 'label' => 'hidden',
+ 'module' => 'socialshareprivacy',
+ 'settings' => array(),
+ 'type' => SOCIALSHAREPRIVACY_FORMATTER,
+ 'weight' => 20,
+ ),
+ ),
+ 'entity_type' => $entity,
+ 'field_name' => $ssp_field_name,
+ 'label' => $t('Placeholder for Social Share Privacy'),
+ 'required' => 0,
+ 'settings' => array(
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'socialshareprivacy',
+ 'settings' => array(
+ 'display_label' => 1,
+ ),
+ 'type' => SOCIALSHAREPRIVACY_WIDGET,
+ 'weight' => 20,
+ ),
+ );
+
+ field_create_instance($instance);
+ }
+}
+
+function __remove_custom_field($entity, $bundle) {
+ $ssp_field_name = variable_get('socialshareprivacy_field_name', 'field_socialshareprivacy');
+ field_cache_clear();
+ if ($instance = field_info_instance($entity, $ssp_field_name, $bundle)) {
+ field_delete_instance($instance);
+ field_purge_batch(2000);
+ }
+}
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.module b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.module
new file mode 100644
index 0000000..f3c77fd
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/socialshareprivacy/socialshareprivacy.module
@@ -0,0 +1,607 @@
+<?php
+
+/**
+ * @file
+ * A social share (facebook, twitter, google+) privacy (two clicks) plugin for jQuery 1.3
+ */
+
+/**
+ * The default path to the socialSharePrivacy directory.
+ */
+define('SOCIALSHAREPRIVACY_PATH', 'sites/all/libraries/socialshareprivacy');
+define('SOCIALSHAREPRIVACY_FIELD_TYPE', variable_get('socialshareprivacy_field_type'));
+define('SOCIALSHAREPRIVACY_FORMATTER', variable_get('socialshareprivacy_formatter'));
+define('SOCIALSHAREPRIVACY_WIDGET', variable_get('socialshareprivacy_widget'));
+define('SOCIALSHAREPRIVACY_DEFAULT_VALUE_SERVICES', serialize(array('facebook' => 'facebook', 'twitter' => 'twitter', 'gplus' => 'gplus')));
+
+/**
+ * Implements hook_help().
+ */
+function socialshareprivacy_help($path, $arg) {
+ switch ($path) {
+ case 'admin/config/user-interface/socialshareprivacy':
+ case 'admin/help#socialshareprivacy':
+ return '<p>' . t('Adds social network buttons to content types and provides a <a href="@urlBlock">block</a> with the 2-click-method “<a href="@urlHeise" target="_blank">socialSharePrivacy</a>“ by Heise Zeitschriften Verlag. So the networks won\'t receive data unless the visitor wants to.', array('@urlBlock' => url('admin/structure/block/manage/socialshareprivacy/socialshareprivacy_block/configure'), '@urlHeise' => 'http://www.heise.de/extras/socialshareprivacy/')) . '</p>';
+ }
+}
+
+
+/**
+ * Implements hook_permission().
+ */
+function socialshareprivacy_permission() {
+ return array(
+ 'administer socialshareprivacy' => array(
+ 'title' => t('administer socialSharePrivacy'),
+ ),
+ 'access socialshareprivacy' => array(
+ 'title' => t('access socialSharePrivacy'),
+ ),
+ );
+}
+
+/**
+ * Implements hook_menu().
+ */
+function socialshareprivacy_menu() {
+ $items = array();
+
+ $items['admin/config/user-interface/socialshareprivacy'] = array(
+ 'title' => 'socialSharePrivacy',
+ 'description' => 'Configure settings for socialSharePrivacy',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('socialshareprivacy_admin_settings'),
+ 'access arguments' => array('administer socialshareprivacy'),
+ 'weight' => -20,
+ 'file' => 'socialshareprivacy.admin.inc',
+ );
+ $items['admin/config/user-interface/socialshareprivacy/settings'] = array(
+ 'title' => 'Settings',
+ 'description' => 'Configure settings for socialSharePrivacy',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('socialshareprivacy_admin_settings'),
+ 'access arguments' => array('administer socialshareprivacy'),
+ 'weight' => -20,
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'file' => 'socialshareprivacy.admin.inc',
+ );
+ $items['admin/config/user-interface/socialshareprivacy/fieldmgmt'] = array(
+ 'title' => 'Field Management',
+ 'description' => 'Add socialSharePrivacy fields to your contenttypes',
+ 'page callback' => 'socialshareprivacy_admin_fieldmgmt',
+ 'access arguments' => array('administer socialshareprivacy'),
+ 'weight' => -19,
+ 'type' => MENU_LOCAL_TASK,
+ 'file' => 'socialshareprivacy.admin.inc',
+ );
+ $items['admin/config/user-interface/socialshareprivacy/bulkupdate'] = array(
+ 'title' => 'Bulk Update',
+ 'description' => 'Update existing nodes',
+ 'page callback' => 'socialshareprivacy_admin_bulkupdate',
+ 'access arguments' => array('administer socialshareprivacy'),
+ 'weight' => -18,
+ 'type' => MENU_LOCAL_TASK,
+ 'file' => 'socialshareprivacy.admin.inc',
+ );
+
+ return $items;
+}
+
+/**
+ * Implement hook_field_info().
+ */
+function socialshareprivacy_field_info() {
+ return array(
+ SOCIALSHAREPRIVACY_FIELD_TYPE => array(
+ 'label' => t('Placeholder for socialSharePrivacy'),
+ 'description' => t('Move this field to the position you want the socialSharePrivacy to be displayed in.'),
+ 'default_widget' => SOCIALSHAREPRIVACY_WIDGET,
+ 'default_formatter' => SOCIALSHAREPRIVACY_FORMATTER,
+ ),
+ );
+}
+
+/**
+ * Implement hook_field_widget_info().
+ */
+function socialshareprivacy_field_widget_info() {
+ return array(
+ SOCIALSHAREPRIVACY_WIDGET => array(
+ 'label' => t('SSP Widget'),
+ 'field types' => array(SOCIALSHAREPRIVACY_FIELD_TYPE),
+ ),
+ );
+}
+
+/**
+ * Implement hook_field_widget().
+ *
+ */
+function socialshareprivacy_field_widget_form(&$form, &$form_state, $field,
+ $instance, $langcode, $items, $delta = 0) {
+
+ $element = array(
+ '#type' => 'checkbox',
+ '#prefix' => '<br/><strong>socialSharePrivacy</strong>',
+ /* '#description' => t('Placeholder for socialSharePrivacy'), */
+ '#title' => t('Display socialSharePrivacy'),
+ '#description' => t('If this box is checked then socialSharePrivacy will be displayed on the view of this node.'),
+ '#default_value' => (isset($items[0]) && isset($items[0]['value'])) ? $items[0]['value'] : 1,
+ '#suffix' => '<br/>',
+ );
+
+ return $element;
+}
+
+/**
+ * Implements hook_field_formatter_info().
+ */
+function socialshareprivacy_field_formatter_info() {
+ return array(
+ SOCIALSHAREPRIVACY_FORMATTER => array(
+ 'label' => t('SSP Formatter'),
+ 'field types' => array(SOCIALSHAREPRIVACY_FIELD_TYPE),
+ 'module' => 'socialshareprivacy',
+ ),
+ );
+}
+
+/**
+ * Implement hoo_field_is_empty().
+ */
+function socialshareprivacy_field_is_empty($item, $field) {
+ return FALSE;
+}
+
+function socialshareprivacy_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
+ if ($field['type'] == SOCIALSHAREPRIVACY_FIELD_TYPE) {
+ foreach ($items as $delta => $item) {
+ if (!is_array($item)) {
+ $items[$delta] = array('value' => $item);
+ }
+ }
+ }
+}
+
+/**
+ * Implements hook_field_formatter_view().
+ */
+function socialshareprivacy_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display) {
+
+ if (!_socialshareprivacy_has_access()) {
+ return NULL;
+ }
+
+ $element = array();
+ if ($field['type']==SOCIALSHAREPRIVACY_FIELD_TYPE) {
+ switch ($display['type']) {
+ case SOCIALSHAREPRIVACY_FORMATTER:
+ foreach ($items as $delta => $item) {
+ if ($item['value'] == "1") {
+ $element[$delta]['#type'] = 'markup';
+
+ $htmlNodeId = $field['field_name'] . '-' . $object->nid;
+ $javascript = _socialshareprivacy_write_javascript($htmlNodeId, url('node/' . $object->nid, array('absolute' => TRUE)));
+ $markup = _socialshareprivacy_get_markup($htmlNodeId);
+ if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && drupal_strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
+ $markup = $markup . '<script type="text/javascript">' . $javascript . '</script>';
+ }
+
+ $element[$delta]['#markup'] = $markup;
+ }
+ }
+ break;
+ }
+ }
+
+ return $element;
+}
+
+/**
+ * Implements hook_block_info().
+ */
+function socialshareprivacy_block_info() {
+ $blocks['socialshareprivacy_block'] = array(
+ // info: The name of the block.
+ 'info' => t('socialSharePrivacy'),
+ // Block caching options (per role, per user, etc.)
+ 'cache' => DRUPAL_NO_CACHE,
+ );
+
+ return $blocks;
+}
+
+/**
+ * Implements hook_block_configure().
+ */
+function socialshareprivacy_block_configure($block_name = '') {
+ if ($block_name == 'socialshareprivacy_block') {
+ $form['help'] = array(
+ '#markup' => t('Additional options can be set on the <a href="/admin/config/user-interface/socialshareprivacy">socialSharePrivacy configuration page</a>.'),
+ );
+
+ return $form;
+ }
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function socialshareprivacy_block_view($delta = 0) {
+
+ if (!_socialshareprivacy_has_access()) {
+ return NULL;
+ }
+
+ return _socialshareprivacy_block($op='view');
+}
+
+/**
+ * Gets the block.
+ */
+function _socialshareprivacy_block($op = 'list', $delta = 0, $edit = array()) {
+ $block = array();
+
+ if ($op == 'view') {
+ $block['subject'] = t('socialSharePrivacy');
+ $block['content'] = _socialshareprivacy_get_markup('socialshareprivacy-block');
+
+ _socialshareprivacy_write_javascript('socialshareprivacy-block');
+ }
+
+ return $block;
+}
+
+/**
+ * Return the path to the socialSharePrivacy plugin.
+ */
+function _socialshareprivacy_get_path() {
+ static $library_path = NULL;
+
+ // Try to locate the library path in any possible setup.
+ if ($library_path == NULL) {
+ // First check the default location.
+ $path = variable_get('socialshareprivacy_path', SOCIALSHAREPRIVACY_PATH);
+ if (is_dir($path . '/socialshareprivacy')) {
+ $library_path = $path;
+ }
+ // Ask the libraries module as a fallback.
+ elseif ($library_path == NULL && module_exists('libraries')) {
+ if ($path = libraries_get_path('socialshareprivacy')) {
+ $library_path = $path;
+ variable_set('socialshareprivacy_path', $library_path);
+ }
+ }
+ // HACK: If libraries api module is not installed but available, load it.
+ elseif ($library_path == NULL && file_exists(dirname(__FILE__) . '/../libraries/libraries.module')) {
+ require_once(dirname(__FILE__) . '/../libraries/libraries.module');
+ if ($path = libraries_get_path('socialshareprivacy')) {
+ $library_path = $path;
+ variable_set('socialshareprivacy_path', $library_path);
+ }
+ }
+ // If no path is found suggest the default one.
+ elseif ($library_path == NULL) {
+ $library_path = SOCIALSHAREPRIVACY_PATH;
+ }
+ }
+
+ return $library_path;
+}
+
+/**
+ * writes the javascript to the page
+ */
+function _socialshareprivacy_get_markup($nodeId = 'socialshareprivacy') {
+ return '<div id="' . $nodeId . '" class="ssp_wrapper">&nbsp;</div>';
+}
+
+/**
+ * writes the javascript to the page
+ *
+ *
+ * @param $nodeId
+ * The unique javascript id.
+ * @param $url
+ * The url to share.
+ * @param $library_path
+ * The patch to SSP.
+ */
+function _socialshareprivacy_write_javascript($nodeId = 'socialshareprivacy', $url = '', $library_path = '') {
+
+ $options = _socialshareprivacy_get_javascript_options($url, $library_path);
+
+ $minFileNamePart = '.min';
+ if (variable_get('socialshareprivacy_js_minified', 'true') == 'false') {
+ $minFileNamePart = '';
+ }
+
+ if (variable_get('socialshareprivacy_reset_css', 'false') == 'true') {
+ drupal_add_css(drupal_get_path('module', 'socialshareprivacy') . '/css/reset.css');
+ }
+
+ drupal_add_js(_socialshareprivacy_get_path() . '/jquery.socialshareprivacy' . $minFileNamePart . '.js', array('group' => JS_LIBRARY));
+ drupal_add_js('(function ($) { jQuery(document).ready(function () { if(jQuery("#' . $nodeId . '").length > 0){ jQuery("#' . $nodeId . '").socialSharePrivacy(' . $options . ');' . _socialshareprivacy_external_link() . ' } }); })(jQuery);', 'inline');
+
+ return '(function ($) { jQuery(document).ready(function () { if(jQuery("#' . $nodeId . '").length > 0){ jQuery("#' . $nodeId . '").socialSharePrivacy(' . $options . ');' . _socialshareprivacy_external_link() . ' } }); })(jQuery);';
+}
+
+/**
+ * Return the javascript options
+ *
+ * @param $url
+ * The url to share.
+ * @param $library_path
+ * The patch to SSP.
+ */
+function _socialshareprivacy_get_javascript_options($url = '', $library_path = '') {
+ global $language;
+
+ $path = $library_path;
+ if ($path == '') {
+ $path = _socialshareprivacy_get_path();
+ }
+ $facebook_dummy = base_path() . $path . '/socialshareprivacy/images/dummy_facebook_en.png';
+ if (variable_get('socialshareprivacy_neutral_button', 'false') == 'true') {
+ $facebook_dummy = base_path() . drupal_get_path('module', 'socialshareprivacy') . '/images/dummy_facebook.png';
+ }
+ elseif ($language->language == 'de' || variable_get('socialshareprivacy_force_german', 'false') == 'true') {
+ $facebook_dummy = base_path() . $path . '/socialshareprivacy/images/dummy_facebook.png';
+ }
+ elseif ($language->language != 'en') {
+ $facebook_dummy = base_path() . drupal_get_path('module', 'socialshareprivacy') . '/images/dummy_facebook.png';
+ }
+
+ /* use the german 'default' texts */
+ if (variable_get('socialshareprivacy_force_german', 'true') == 'true') {
+ $options = "{
+ services : {
+ facebook : {
+ 'status' : '" . _socialshareprivacy_service_status("facebook") . "',
+ 'dummy_img' : '" . $facebook_dummy . "',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("facebook") . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "',
+ 'action' : '" . check_plain(variable_get('socialshareprivacy_facebook_action', 'recommend')) . "'
+ },
+ twitter : {
+ 'status' : '" . _socialshareprivacy_service_status("twitter") . "',
+ 'dummy_img' : '" . base_path() . $path . "/socialshareprivacy/images/dummy_twitter.png',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("twitter") . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "'
+ },
+ gplus : {
+ 'status' : '" . _socialshareprivacy_service_status("gplus") . "',
+ 'dummy_img' : '" . base_path() . $path . "/socialshareprivacy/images/dummy_gplus.png',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("gplus") . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "'
+ }
+ },
+ 'css_path': '" . base_path() . $path . "/socialshareprivacy/socialshareprivacy.css',
+ 'cookie_expires' : '" . variable_get('socialshareprivacy_cookie_expires', '365') . "',
+ 'info_link': '" . url(variable_get('socialshareprivacy_ext_link_target', 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html')) . "'";
+ }
+ else {
+ $options = "{
+ services : {
+ facebook : {
+ 'status' : '" . _socialshareprivacy_service_status("facebook") . "',
+ 'dummy_img' : '" . $facebook_dummy . "',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("facebook") . "',
+ 'language' : '" . _socialshareprivacy_map_facebook_language($language->language) . "',
+ 'txt_info' : '" . _socialshareprivacy_escape_javascript(t('2 clicks for more privacy: Click here to activate the Facebook share button. Please note that activating the share button will already transfer data to Facebook. For more information please click on the <em>i</em>')) . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "',
+ 'action' : '" . variable_get('socialshareprivacy_facebook_action', 'recommend') . "'
+ },
+ twitter : {
+ 'status' : '" . _socialshareprivacy_service_status("twitter") . "',
+ 'dummy_img' : '" . base_path() . $path . "/socialshareprivacy/images/dummy_twitter.png',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("twitter") . "',
+ 'language' : '" . $language->language . "',
+ 'txt_info' : '" . _socialshareprivacy_escape_javascript(t('2 clicks for more privacy: Click here to activate the Twitter share button. Please note that activating the share button will already transfer data to Twitter. For more information please click on the <em>i</em>')) . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "'
+ },
+ gplus : {
+ 'status' : '" . _socialshareprivacy_service_status("gplus") . "',
+ 'dummy_img' : '" . base_path() . $path . "/socialshareprivacy/images/dummy_gplus.png',
+ 'perma_option' : '" . _socialshareprivacy_service_permaoption_status("gplus") . "',
+ 'language' : '" . $language->language . "',
+ 'txt_info' : '" . _socialshareprivacy_escape_javascript(t('2 clicks for more privacy: Click here to activate the Google+ share button. Please note that activating the share button will already transfer data to Google. For more information please click on the <em>i</em>')) . "',
+ 'referrer_track' : '" . _socialshareprivacy_get_referer_track() . "'
+ }
+ },
+ 'css_path': '" . base_path() . $path . "/socialshareprivacy/socialshareprivacy.css',
+ 'cookie_expires' : '" . (is_numeric(variable_get('socialshareprivacy_cookie_expires', '365')) ? variable_get('socialshareprivacy_cookie_expires', '365') : '365') . "',
+ 'txt_help' : '" . _socialshareprivacy_escape_javascript(t('If you enable any of these options then the corresponding social network will receive and store data about your visit on this site. For more information please click on the <em>i</em>')) . "',
+ 'settings_perma' : '" . _socialshareprivacy_escape_javascript(t('Agree to permanent activation and thus data transfer:')) . "',
+ 'info_link': '" . url(variable_get('socialshareprivacy_ext_link_target', 'http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html')) . "'";
+ }
+
+ if ($url != '') {
+ $options = $options . ",
+ 'uri' : '" . $url . "'";
+ }
+
+ $options = $options . "
+ }";
+
+ return $options;
+}
+
+/**
+ * Checks if the directory in $form_element exists and contains a file named
+ * 'jquery.socialshareprivacy.js'. If validation fails, the form element is flagged
+ * with an error from within the file_check_directory function.
+ *
+ * @param $form_element
+ * The form element containing the name of the directory to check.
+ */
+function _socialshareprivacy_admin_settings_check_plugin_path($form_element) {
+ $library_path = $form_element['#value'];
+ if (!is_dir($library_path) || !(file_exists($library_path . '/jquery.socialshareprivacy.js') && file_exists($library_path . '/jquery.socialshareprivacy.min.js'))) {
+ form_set_error($form_element['#parents'][0], t('You need to download the <a href="@urlSSP" target="_blank">socialSharePrivacy</a> and extract the entire contents of the archive into the %path folder of your server.', array('@urlSSP' => 'http://www.heise.de/extras/socialshareprivacy/', '%path' => $library_path)));
+ }
+
+ return $form_element;
+}
+
+/**
+ * Get the status on/off for a service.
+ */
+function _socialshareprivacy_service_status($service) {
+ $settings = variable_get('socialshareprivacy_services', unserialize(SOCIALSHAREPRIVACY_DEFAULT_VALUE_SERVICES));
+ if (array_key_exists($service, $settings) && $settings[$service] !== 0) {
+ return "on";
+ }
+ return "off";
+}
+
+/**
+ * Get the status on/off for a perma option.
+ */
+function _socialshareprivacy_service_permaoption_status($service) {
+ $settings = variable_get('socialshareprivacy_services_permaoption', unserialize(SOCIALSHAREPRIVACY_DEFAULT_VALUE_SERVICES));
+ if (array_key_exists($service, $settings) && $settings[$service] !== 0) {
+ return "on";
+ }
+ return "off";
+}
+
+/**
+ * Translates and escapes '.
+ */
+function _socialshareprivacy_escape_javascript($text) {
+ return addslashes(filter_xss($text));
+}
+
+/**
+ * Gets the plain referer track string.
+ */
+function _socialshareprivacy_get_referer_track() {
+ return check_plain(variable_get('socialshareprivacy_referrertrack', ''));
+}
+
+/**
+ * Get the external link JS.
+ */
+function _socialshareprivacy_external_link() {
+ $setting = variable_get('socialshareprivacy_ext_link', '');
+ if ($setting == 'remove') {
+ return " setTimeout('(function ($) { $(\'div.settings_info_menu > a\').click(function(){ return false; }); })(jQuery);', 300);";
+ }
+ elseif ($setting == 'blank') {
+ return " setTimeout('(function ($) { $(\'div.settings_info_menu > a\').attr(\'target\', \'_blank\'); })(jQuery);', 300);";
+ }
+ return "";
+}
+
+/**
+ * maps drupal language code to facebook langauge code
+ */
+function _socialshareprivacy_map_facebook_language($language) {
+ $lang_map = array(
+ 'af' => 'af_ZA',
+ 'ar' => 'ar_AR',
+ 'ay' => 'ay_BO',
+ 'az' => 'az_AZ',
+ 'be' => 'be_BY',
+ 'bg' => 'bg_BG',
+ 'bn' => 'bn_IN',
+ 'bs' => 'bs_BA',
+ 'ca' => 'ca_ES',
+ 'ck' => 'ck_US',
+ 'cs' => 'cs_CZ',
+ 'cy' => 'cy_GB',
+ 'da' => 'da_DK',
+ 'de' => 'de_DE',
+ 'el' => 'el_GR',
+ 'en' => 'en_US',
+ 'eo' => 'eo_EO',
+ 'es' => 'es_ES',
+ 'et' => 'et_EE',
+ 'eu' => 'eu_ES',
+ 'fa' => 'fa_IR',
+ 'fb' => 'fb_FI',
+ 'fb' => 'fb_LT',
+ 'fi' => 'fi_FI',
+ 'fo' => 'fo_FO',
+ 'fr' => 'fr_CA',
+ 'fr' => 'fr_FR',
+ 'ga' => 'ga_IE',
+ 'gl' => 'gl_ES',
+ 'gn' => 'gn_PY',
+ 'gu' => 'gu_IN',
+ 'he' => 'he_IL',
+ 'hi' => 'hi_IN',
+ 'hr' => 'hr_HR',
+ 'hu' => 'hu_HU',
+ 'hy' => 'hy_AM',
+ 'id' => 'id_ID',
+ 'is' => 'is_IS',
+ 'it' => 'it_IT',
+ 'ja' => 'ja_JP',
+ 'jv' => 'jv_ID',
+ 'ka' => 'ka_GE',
+ 'kk' => 'kk_KZ',
+ 'km' => 'km_KH',
+ 'kn' => 'kn_IN',
+ 'ko' => 'ko_KR',
+ 'ku' => 'ku_TR',
+ 'la' => 'la_VA',
+ 'li' => 'li_NL',
+ 'lt' => 'lt_LT',
+ 'lv' => 'lv_LV',
+ 'mg' => 'mg_MG',
+ 'mk' => 'mk_MK',
+ 'ml' => 'ml_IN',
+ 'mn' => 'mn_MN',
+ 'mr' => 'mr_IN',
+ 'ms' => 'ms_MY',
+ 'mt' => 'mt_MT',
+ 'nb' => 'nb_NO',
+ 'ne' => 'ne_NP',
+ 'nl' => 'nl_BE',
+ 'nl' => 'nl_NL',
+ 'nn' => 'nn_NO',
+ 'pa' => 'pa_IN',
+ 'pl' => 'pl_PL',
+ 'ps' => 'ps_AF',
+ 'pt' => 'pt_PT',
+ 'qu' => 'qu_PE',
+ 'rm' => 'rm_CH',
+ 'ro' => 'ro_RO',
+ 'ru' => 'ru_RU',
+ 'sa' => 'sa_IN',
+ 'se' => 'se_NO',
+ 'sk' => 'sk_SK',
+ 'sl' => 'sl_SI',
+ 'so' => 'so_SO',
+ 'sq' => 'sq_AL',
+ 'sr' => 'sr_RS',
+ 'sv' => 'sv_SE',
+ 'sw' => 'sw_KE',
+ 'sy' => 'sy_SY',
+ 'ta' => 'ta_IN',
+ 'te' => 'te_IN',
+ 'tg' => 'tg_TJ',
+ 'th' => 'th_TH',
+ 'tl' => 'tl_PH',
+ 'tl' => 'tl_ST',
+ 'tr' => 'tr_TR',
+ 'tt' => 'tt_RU',
+ 'uk' => 'uk_UA',
+ 'ur' => 'ur_PK',
+ 'uz' => 'uz_UZ',
+ 'vi' => 'vi_VN',
+ 'xh' => 'xh_ZA',
+ 'yi' => 'yi_DE',
+ 'zh' => 'zh_CN',
+ 'zu' => 'zu_ZA',
+ );
+ $return = @$lang_map[$language];
+ if (empty($return)) $return = 'en_US';
+ return $return;
+}
+
+function _socialshareprivacy_has_access() {
+ return user_access('access socialshareprivacy');
+} \ No newline at end of file