You are here

sharethis.install in ShareThis 8.2

Same filename and directory in other branches
  1. 6 sharethis.install
  2. 7.2 sharethis.install
  3. 7 sharethis.install

This file holds the install information for the ShareThis Module.

File

sharethis.install
View source
<?php

/**
 * @file
 * This file holds the install information for the ShareThis Module.
 */

/**
 * Implements hook_install().
 */
function sharethis_install() {
  \Drupal::configFactory()
    ->getEditable('sharethis.settings')
    ->set('publisherID', sharethis_create_publisher_key())
    ->save();
}

/**
 * Creates a publisher key for use with the ShareThis API.
 */
function sharethis_create_publisher_key() {
  $pubkey = "dr-";
  $pubkey .= dechex(mt_rand(0, 0xffff));
  $pubkey .= dechex(mt_rand(0, 0xffff)) . "-";
  $pubkey .= dechex(mt_rand(0, 0xffff)) . "-";
  $pubkey .= dechex(mt_rand(0, 0xffff)) . "-";
  $pubkey .= dechex(mt_rand(0, 0xffff)) . "-";
  $pubkey .= dechex(mt_rand(0, 0xffff));
  $pubkey .= dechex(mt_rand(0, 0xffff));
  $pubkey .= dechex(mt_rand(0, 0xffff));
  return $pubkey;
}

Functions

Namesort descending Description
sharethis_create_publisher_key Creates a publisher key for use with the ShareThis API.
sharethis_install Implements hook_install().