You are here

public static function ShareaholicPublic::is_shareable in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 public.php \ShareaholicPublic::is_shareable()

Determines the shareability of a piece of content and returns that value

Possible values are: 'true', 'false', and NULL

Parameters

Object $node The content to determine its shareability:

Return value

String a string indicating if it is shareable or not

1 call to ShareaholicPublic::is_shareable()
ShareaholicPublic::insert_content_meta_tags in ./public.php
Inserts the shareaholic content meta tags on the page On all pages, it will insert the standard content meta tags On full post pages, it will insert page specific content meta tags

File

./public.php, line 411

Class

ShareaholicPublic
This class is all about drawing the stuff in publishers' templates that visitors can see.

Code

public static function is_shareable($node) {
  $shareable = NULL;

  // Check if it is a draft
  if (isset($node->status) && $node->status == 0) {
    $shareable = 'false';
  }

  // Check if a site visitor can see the content
  try {
    $anonymous_user = user_load(0);
    if ($anonymous_user && !node_access('view', $node, $anonymous_user)) {
      $shareable = 'false';
    }
  } catch (Exception $e) {
    ShareaholicUtilities::log('Error in checking node_access: ' . $e
      ->getMessage());
  }
  return $shareable;
}