function service_links_show in Service links 6.2
Same name and namespace in other branches
- 7.2 service_links.module \service_links_show()
Check if the service links should be displayed for the content type, for category or one of the other selected options.
13 calls to service_links_show()
- service_links_block in ./
service_links.module - Implementation of hook_block().
- service_links_link in ./
service_links.module - Implementation of hook_link().
- service_links_nodeapi in ./
service_links.module - Implementation of hook_nodeapi().
- themename_preprocess in ./
template.php - If something doesn't work well try this.
- themename_preprocess_node in ./
template.php - Example 2: Creating the variable '$twitter' for the template file 'node.tpl.php' containing the services specified by their ids (i.e. twitter).
3 string references to 'service_links_show'
- service_links_admin_services in ./
service_links.admin.inc - Menu callback administration settings for services links list.
- service_links_update_6200 in ./
service_links.install - Update from Service Links 1.x.
- _service_links_load_settings in ./
service_links.module - Load the static settings and keep clear the render function.
File
- ./
service_links.module, line 835 - Adds social network links to the content.
Code
function service_links_show($node) {
$links_show = FALSE;
$category_type = FALSE;
global $user;
if (!_service_links_match_path()) {
return FALSE;
}
if (in_array(strtolower(arg(0)), array(
'print',
'printpdf',
'printmail',
))) {
return FALSE;
}
if (variable_get('service_links_hide_for_author', FALSE) && $user->uid == $node->uid) {
return FALSE;
}
if (variable_get('service_links_hide_if_unpublished', FALSE) && $node->status == '0') {
return FALSE;
}
$node_type = in_array($node->type, variable_get('service_links_node_types', array()), TRUE);
if (module_exists('taxonomy')) {
$terms = taxonomy_node_get_terms($node);
$categories_allowed = variable_get('service_links_category_types', array());
foreach ($terms as $term) {
$category_type |= in_array($term->tid, $categories_allowed, FALSE);
}
}
if ($node_type || $category_type) {
$links_show = TRUE;
}
return $links_show;
}