public static function ShareaholicPublic::get_visibility in Share Buttons, Related Posts, Content Analytics - Shareaholic 8
Same name and namespace in other branches
- 7.3 public.php \ShareaholicPublic::get_visibility()
Determines the visibility of a piece of content and returns that value
Possible values are: 'draft', 'private', and NULL
Parameters
Object $node The content to determine its visibility:
Return value
String a string indicating its visibility
1 call to ShareaholicPublic::get_visibility()
- 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 377
Class
- ShareaholicPublic
- This class is all about drawing the stuff in publishers' templates that visitors can see.
Code
public static function get_visibility($node) {
$visibility = NULL;
// Check if it is a draft
if (isset($node->status) && $node->status == 0) {
$visibility = 'draft';
}
// Check if it should be excluded from recommendations
if (isset($node->shareaholic_options) && $node->shareaholic_options['shareaholic_exclude_from_recommendations']) {
$visibility = 'private';
}
// Check if a site visitor can see the content
try {
$anonymous_user = user_load(0);
if ($anonymous_user && !node_access('view', $node, $anonymous_user)) {
$visibility = 'private';
}
} catch (Exception $e) {
ShareaholicUtilities::log('Error in checking node_access: ' . $e
->getMessage());
}
return $visibility;
}