You are here

function _sharethis_sharethis_this_show in ShareThis 5

Check if the service links should be displayed for the node type/category.

2 calls to _sharethis_sharethis_this_show()
sharethis_link in ./sharethis.module
Implementation of hook_link().
sharethis_nodeapi in ./sharethis.module
Implementation of hook_nodeapi().

File

./sharethis.module, line 160
Provides the ShareThis service.

Code

function _sharethis_sharethis_this_show($type, $nid) {

  // Check to see if the node type is to display the ShareThis.
  $node_type = in_array($type, variable_get('sharethis_sharethis_this_node_types', array()), TRUE);
  $category_type = FALSE;

  // Check to see if Taxonomy is enabled and the node has a vocabulary.
  if (module_exists('taxonomy') && isset($node->vid)) {
    $terms = taxonomy_node_get_terms($nid);
    foreach ($terms as $term) {
      $category_type = in_array($term->tid, variable_get('sharethis_sharethis_this_category_types', array()), FALSE);
      if ($category_type) {

        // Stop looping because we found that the category is to be displayed.
        break;
      }
    }
  }
  return $node_type || $category_type;
}