You are here

public static function ShareaholicPublic::insert_script_tag in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3

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

Inserts the script code snippet into the head of the public pages of the site if they have accepted ToS and have apikey

1 call to ShareaholicPublic::insert_script_tag()
shareaholic_init in ./shareaholic.module
Implements hook_init() This gets called at the beginning of a non-cached page request Ideal for setting response headers

File

./public.php, line 26

Class

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

Code

public static function insert_script_tag() {
  if (!ShareaholicUtilities::is_admin_page() && ShareaholicUtilities::has_tos_and_apikey()) {
    $markup = self::js_snippet();
    $element = array(
      '#type' => 'markup',
      '#markup' => $markup,
    );
    drupal_add_html_head($element, 'shareaholic_script_tag');
  }
}