Skip to content

Commit

Permalink
fix for issue #1170 in info file
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Martha committed Sep 14, 2015
1 parent d4ded13 commit c6ed054
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 58 deletions.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified ShareThisForm.css
100644 → 100755
Empty file.
Empty file modified ShareThisForm.js
100644 → 100755
Empty file.
Empty file modified config/sharethis.settings.json
100644 → 100755
Empty file.
Empty file modified git
100644 → 100755
Empty file.
Empty file modified img/Direction_Icons_Sprite.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/b_classic.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/button.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/hcount.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/large.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/preview_bg.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/preview_sprite.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/small.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/vcount.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img/widget.png
100644 → 100755
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified plugins/content_types/sharethis/sharethis.inc
100644 → 100755
Empty file.
37 changes: 16 additions & 21 deletions readme.md
100644 → 100755
@@ -1,10 +1,25 @@
SHARETHIS
===================
---------------------

Sharethis places those "Share with..." icons/links on the content on your page.

Integration with the ShareThis social bookmarking utility on selected node types.

CONTENTS OF THIS FILE
---------------------

- Introduction
- Tested
- Known Issues
- Special Thanks
- Requirements
- Installation
- Coming From Drupal?
- Usage
- License
- Credits
- Maintainers

The code for this project was based on the original share project for Drupal 5.x. The code for this project has been trimmed down to only work with the ShareThis system, and not require any additional modules to work properly.

Features
Expand All @@ -25,21 +40,6 @@ Place a ShareThis block anywhere on your site

Views integration

CONTENTS OF THIS FILE
---------------------

- Introduction
- Tested
- Known Issues
- Special Thanks
- Requirements
- Installation
- Coming From Drupal?
- Usage
- License
- Credits
- Maintainers

TESTED
-----

Expand All @@ -52,11 +52,6 @@ None critical for Backdrop yet. Using a different way to append Sharethis than

There are many, many options to this module and not all of them have been tested for Backdrop CMS yet.

SPECIAL THANKS
--------------

Sponsors include Disqus, ImageX Media, AETN, Acquia and Examiner.com.

REQUIREMENTS
------------

Expand Down
5 changes: 2 additions & 3 deletions sharethis.info
100644 → 100755
@@ -1,10 +1,9 @@
name = ShareThis
description = Add the <a href="http://www.sharethis.com/">ShareThis</a> widget to nodes on your site.
version = BACKDROP_VERSION
backdrop = 1.x-1.1
backdrop = 1.x
version = 1.x-1.2.1
package = Social
configure = admin/config/services/sharethis
type = module

; Views handlers
files[] = views/sharethis_handler_field_link.inc
Empty file modified sharethis.install
100644 → 100755
Empty file.
68 changes: 34 additions & 34 deletions sharethis.module
100644 → 100755
Expand Up @@ -201,7 +201,7 @@ function sharethis_configuration_form($form, &$form_state) {
$form['context']['sharethis_comments'] = array(
'#title' => t('Comments'),
'#type' => 'checkbox',
'#default_value' => config_get('sharethis.settings', 'sharethis_comments'),
'#default_value' => config_get('sharethis.settings', 'sharethis_comments'),
'#description' => t('Display ShareThis on comments.'),
'#access' => module_exists('comment'),
);
Expand All @@ -211,7 +211,7 @@ function sharethis_configuration_form($form, &$form_state) {
'#required' => FALSE,
'#type' => 'select',
'#options' => backdrop_map_assoc(array(-100, -50, -25, -10, 0, 10, 25, 50, 100)),
'#default_value' => config_get('sharethis.settings', 'sharethis_weight'),
'#default_value' => config_get('sharethis.settings', 'sharethis_weight'),
);
$form['advanced'] = array(
'#type' => 'fieldset',
Expand All @@ -229,43 +229,43 @@ function sharethis_configuration_form($form, &$form_state) {
'#title' => t('Late Load'),
'#description' => t("You can change the order in which ShareThis widget loads on the user's browser. By default the ShareThis widget loader loads as soon as the browser encounters the JavaScript tag; typically in the tag of your page. ShareThis assets are generally loaded from a CDN closest to the user. However, if you wish to change the default setting so that the widget loads after your web-page has completed loading then you simply tick this option."),
'#type' => 'checkbox',
'#default_value' => config_get('sharethis.settings', 'sharethis_late_load'),
'#default_value' => config_get('sharethis.settings', 'sharethis_late_load'),
);
$form['advanced']['sharethis_twitter_suffix'] = array(
'#title' => t("Twitter Suffix"),
'#description' => t("Optionally append a Twitter handle, or text, so that you get pinged when someone shares an article. Example: <em>via @YourNameHere</em>"),
'#type' => 'textfield',
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_suffix'),
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_suffix'),
);
$form['advanced']['sharethis_twitter_handle'] = array(
'#title' => t('Twitter Handle'),
'#description' => t('Twitter handle to use when sharing.'),
'#type' => 'textfield',
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_handle'),
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_handle'),
);
$form['advanced']['sharethis_twitter_recommends'] = array(
'#title' => t('Twitter recommends'),
'#description' => t('Specify a twitter handle to be recommended to the user.'),
'#type' => 'textfield',
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_recommends'),
'#default_value' => config_get('sharethis.settings', 'sharethis_twitter_recommends'),
);
$form['advanced']['sharethis_option_onhover'] = array(
'#type' => 'checkbox',
'#title' => t('Display ShareThis widget on hover'),
'#description' => t('If disabled, the ShareThis widget will be displayed on click instead of hover.'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_onhover'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_onhover'),
);
$form['advanced']['sharethis_option_neworzero'] = array(
'#type' => 'checkbox',
'#title' => t('Display count "0" instead of "New"'),
'#description' => t('Display a zero (0) instead of "New" in the count for content not yet shared.'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_neworzero'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_neworzero'),
);
$form['advanced']['sharethis_option_shorten'] = array(
'#type' => 'checkbox',
'#title' => t('Display short URL'),
'#description' => t('Display either the full or the shortened URL.'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_shorten'),
'#default_value' => config_get('sharethis.settings', 'sharethis_option_shorten'),
);
$form['advanced']['sharethis_cns'] = array(
'#title' => t('<b>CopyNShare </b><sup>(<a href="http://support.sharethis.com/customer/portal/articles/517332-share-widget-faqs#copynshare" target="_blank">?</a>)</sup>'),
Expand Down Expand Up @@ -342,12 +342,12 @@ function sharethis_configuration_form_validate($form, &$form_state) {
*/
function sharethis_configuration_form_submit($form, &$form_state) {
// If the location is changing to/from 'content', clear the Field Info cache.
$current_location = config_get('sharethis.settings', 'sharethis_location');
$current_location = config_get('sharethis.settings', 'sharethis_location');
$new_location = $form_state['values']['sharethis_location'];
if (($current_location == 'content' || $new_location == 'content') && $current_location != $new_location) {
field_info_cache_clear();
}

$config = config('sharethis.settings');

foreach ($form_state['values'] as $key => $value)
Expand Down Expand Up @@ -398,17 +398,17 @@ function sharethis_node_view($node, $view_mode, $langcode) {
}
// First get all of the options for the sharethis widget from the database:
$data_options = sharethis_get_options_array();

// Get the full path to insert into the Share Buttons.
$mPath = url('node/' . $node->nid, array('absolute' => TRUE));
$mTitle = $node->title;

// Check where we want to display the ShareThis widget.
switch (config_get('sharethis.settings', 'sharethis_location')) {
switch (config_get('sharethis.settings', 'sharethis_location')) {
case 'content':
$enabled_types = $data_options['sharethis_node_types'];
if (isset($enabled_types[$node->type]) && $enabled_types[$node->type] === $node->type) {

// Inject the extra services.
foreach ($data_options['option_extras'] as $service) {
$data_options['services'] .= ',"' . $service . '"';
Expand All @@ -431,7 +431,7 @@ function sharethis_node_view($node, $view_mode, $langcode) {
// Find the service code name.
$serviceCodeName = backdrop_substr($service[1], 0, -1);
// Switch the title on a per-service basis if required.
$title = $m_title;
$title = $mTitle;
switch ($serviceCodeName) {
case 'twitter':
$title = empty($data_options['twitter_suffix']) ? $title : check_plain($title) . ' ' . check_plain($data_options['twitter_suffix']);
Expand All @@ -442,7 +442,7 @@ function sharethis_node_view($node, $view_mode, $langcode) {
$display = check_plain($serviceCodeName);

//// Put together the span attributes.
$st_spans .='<span st_url="' . $m_path . '" st_title="' . $title . '" class="st_' . $display . $type . '"';
$st_spans .='<span st_url="' . $mPath . '" st_title="' . $title . '" class="st_' . $display . $type . '"';

if ($serviceCodeName == 'twitter') {
if (!empty($data_options['twitter_handle'])) {
Expand All @@ -452,11 +452,11 @@ function sharethis_node_view($node, $view_mode, $langcode) {

$st_spans .='</span>';
}
$st_spans .='</div></div>';
$st_spans .='</div></div>';

$node->content['node'] = array(
'#markup' => $st_spans,
'#weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
'#markup' => $st_spans,
'#weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
);
sharethis_include_js();
}
Expand All @@ -477,7 +477,7 @@ function sharethis_node_view($node, $view_mode, $langcode) {
),
'#tag' => 'div', // Wrap it in a div.
'#type' => 'html_tag',
'#weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
'#weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
);
}
dsm($node->content['links']);
Expand All @@ -491,14 +491,14 @@ function sharethis_node_view($node, $view_mode, $langcode) {
function sharethis_field_extra_fields() {
$extra = array();
// Only add extra fields if the location is the node content.
if (config_get('sharethis.settings', 'sharethis_location')) {
if (config_get('sharethis.settings', 'sharethis_location')) {
$entity_info = entity_get_info('node');
foreach ($entity_info['bundles'] as $bundle => $bundle_info) {
$extra['node'][$bundle]['display'] = array(
'sharethis' => array(
'label' => t('ShareThis'),
'description' => t('ShareThis links'),
'weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
'weight' => intval(config_get('sharethis.settings', 'sharethis_weight')),
),
);
}
Expand Down Expand Up @@ -552,10 +552,10 @@ function sharethis_get_options_array() {
$view_modes = array();
foreach (array_keys(node_type_get_types()) as $type) {
$view_modes[$type] = config_get('sharethis.settings', 'sharethis_' . $type . '_options');
}
}
return array(
'buttons' => config_get('sharethis.settings', 'sharethis_button_option'),
'publisherID' => config_get('sharethis.settings', 'sharethis_publisherID'),
'publisherID' => config_get('sharethis.settings', 'sharethis_publisherID'),
'services' => config_get('sharethis.settings', 'sharethis_service_option'),
'option_extras' => config_get('sharethis.settings', 'sharethis_option_extras'),
'widget' => config_get('sharethis.settings', 'sharethis_widget_option'),
Expand Down Expand Up @@ -592,15 +592,15 @@ function sharethis_include_js() {
$st_js .= 'var ' . $name . ' = ' . backdrop_json_encode($value) . ';';
}
backdrop_add_js($st_js, 'inline');

//$external = "//ws.sharethis.com/button/buttons.js";
$external = ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? "https://ws." : "http://w.") . "sharethis.com/button/buttons.js";
backdrop_add_js($external, 'external');

$stlight = get_stLight_options($data_options);
$st_js = "if (stLight !== undefined) { stLight.options($stlight); }";
backdrop_add_js($st_js, 'inline');

$has_run = TRUE;
}
return $has_run;
Expand Down Expand Up @@ -638,15 +638,15 @@ function sharethis_block_contents() {
if (config_get('sharethis.settings', 'sharethis_location') == 'block') {
// First get all of the options for the sharethis widget from the database:
$data_options = sharethis_get_options_array();

$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
if ($path == config_get('system.core', 'site_frontpage')) {
if ($path == config_get('system.core', 'site_frontpage')) {
$path = "<front>";
}
$mPath = url($path, array('absolute' => TRUE));
$mTitle = decode_entities(backdrop_get_title());


// Inject the extra services.
foreach ($data_options['option_extras'] as $service) {
$data_options['services'] .= ',"' . $service . '"';
Expand All @@ -669,7 +669,7 @@ function sharethis_block_contents() {
// Find the service code name.
$serviceCodeName = backdrop_substr($service[1], 0, -1);
// Switch the title on a per-service basis if required.
$title = $m_title;
$title = $mTitle;
switch ($serviceCodeName) {
case 'twitter':
$title = empty($data_options['twitter_suffix']) ? $title : check_plain($title) . ' ' . check_plain($data_options['twitter_suffix']);
Expand All @@ -690,7 +690,7 @@ function sharethis_block_contents() {

$st_spans .='</span>';
}
$st_spans .='</div></div>';
$st_spans .='</div></div>';

sharethis_include_js();
}
Expand Down Expand Up @@ -751,4 +751,4 @@ function sharethis_ctools_plugin_directory($module, $plugin) {
if ($module == 'panels' || $module == 'ctools') {
return 'plugins/' . $plugin;
}
}
}
Empty file modified sharethis.original.inc
100644 → 100755
Empty file.
Empty file modified stlib_picker.css
100644 → 100755
Empty file.
Empty file modified stlib_picker.js
100644 → 100755
Empty file.
Empty file modified views/sharethis.views.inc
100644 → 100755
Empty file.
Empty file modified views/sharethis_handler_field_link.inc
100644 → 100755
Empty file.

0 comments on commit c6ed054

Please sign in to comment.