You are here

function _addtoany_create_script in AddToAny Share Buttons 6.3

Same name and namespace in other branches
  1. 5.0 addtoany.module \_addtoany_create_script()
  2. 6.2 addtoany.module \_addtoany_create_script()
  3. 7.4 addtoany.module \_addtoany_create_script()
  4. 7 addtoany.module \_addtoany_create_script()
  5. 7.3 addtoany.module \_addtoany_create_script()

Internal function to call the async script loading function right after the first AddToAny button, to utilize concurrent downloading and increase overall page-load performance.

Parameters

object $id_num:

object $link_name:

object $link_url:

Return value

String containing the asynchronous load JavaScript for the first button.

1 call to _addtoany_create_script()
_addtoany_create_button in ./addtoany.module
Internal function to generate code for AddToAny button

File

./addtoany.module, line 198
Standalone module file to handle AddToAny button integration

Code

function _addtoany_create_script($id_num, $link_name, $link_url) {
  global $_addtoany_targets, $_addtoany_init;
  if (!isset($_addtoany_targets)) {
    $_addtoany_targets = array();
  }
  $_addtoany_targets[] = "\n{title:'" . check_plain($link_name) . "'," . "url:'" . check_plain($link_url) . "'}";
  if (!$_addtoany_init) {
    $javascript_load_early = "<script type=\"text/javascript\">\n" . "<!--//--><![CDATA[//><!--\n" . "da2a.script_load();\n" . "//--><!]]>\n" . "</script>";
  }
  else {
    $javascript_load_early = "";
  }
  $_addtoany_init = TRUE;
  return $javascript_load_early;
}