gl_get_script_footer

The Google Locker for WordPress gl get script footer function.

Description

gl_get_script_footer(); 

Usage

  1. if ( !function_exists( 'gl_get_script_footer' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-locker-for-wordpress/admin/shortcode.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gl_get_script_footer(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/admin/shortcode.php  
  1. function gl_get_script_footer() { 
  2. global $count; 
  3.  
  4. // General Values 
  5. $general_settings = gl_get_general_settings_values(); 
  6.  
  7. // Configure Urls 
  8. $postID = get_the_ID(); 
  9.  
  10. // Use postID = 0 and count = 1 in admin mode 
  11. if ( is_admin() ) { 
  12. $postID = 0; 
  13. $count = 1; 
  14.  
  15. // Footer Script and Callback Functions 
  16. $script_footer = $script_footer . ' 
  17. <!--  
  18. Creater Script for Google Locker 
  19. Created by WPTP Net 
  20. http://wptp.net 
  21. --> 
  22. '; 
  23.  
  24. // Google & Youtube Callback 
  25. if ( $general_settings[ 'google_active' ] || $general_settings[ 'google_share' ] || $general_settings[ 'youtube_active' ] ) { 
  26. $script_footer = $script_footer . ' 
  27. <script type="text/javascript"> 
  28. window.___gcfg = {lang: "' . $general_settings[ 'short_language' ] .'"}; 
  29.  
  30. (function() { 
  31. varpo= document.createElement("script"); po.type = "text/javascript"; po.async = true; 
  32. po.src = "https://apis.google.com/js/platform.js"; 
  33. var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); 
  34. })(); 
  35. </script> 
  36. <script type="text/javascript"> 
  37. function gl_unlock_g_social() { 
  38. gl_unlocksocial( "google" ); 
  39. }; 
  40. function gl_unlock_g_content() { 
  41. gl_unlockcontent( "google" ); 
  42. }; 
  43.  
  44. function gl_unlock_g_share_start_social( params ) { 
  45. if ( params.type == "confirm" ) 
  46. console.log("start social confirm"); 
  47. else if ( params.type == "hover" ) 
  48. console.log("start social hover"); 
  49. }; 
  50. function gl_unlock_g_share_start_content( params ) { 
  51. if ( params.type == "confirm" ) 
  52. console.log("start content confirm"); 
  53. else if ( params.type == "hover" ) 
  54. console.log("start content hover"); 
  55. }; 
  56.  
  57. function gl_unlock_g_share_end_social( params ) { 
  58. if ( params.type == "confirm" ) 
  59. gl_unlocksocial( "google_share" ); 
  60. else if ( params.type == "hover" ) 
  61. console.log("end social hover"); 
  62. }; 
  63. function gl_unlock_g_share_end_content( params ) { 
  64. if ( params.type == "confirm" ) 
  65. gl_unlockcontent( "google_share" ); 
  66. else if ( params.type == "hover" ) 
  67. console.log("end content hover"); 
  68. }; 
  69. </script> 
  70. <script type="text/javascript"> 
  71. function gl_unlock_y_social( payload ) { 
  72. if (payload.eventType == "subscribe") { 
  73. gl_unlocksocial( "youtube" ); 
  74. }  
  75. }; 
  76. function gl_unlock_y_content( payload ) { 
  77. if (payload.eventType == "subscribe") { 
  78. gl_unlockcontent( "youtube" ); 
  79. }; 
  80. </script> 
  81. '; 
  82.  
  83. // Lock & Unlock script 
  84. $script_footer = $script_footer . ' 
  85. <script type="text/javascript"> 
  86. var glTimerSocial = setInterval ( function() { lock("g-locker-to-lock-social"); }, 100 ); 
  87. var glTimerContent = setInterval ( function() { lock("g-locker-to-lock-content"); }, 100 ); 
  88.  
  89. function gl_unlocksocial( social ) { 
  90. clearInterval(glTimerSocial); 
  91. gl_createCookie("g_locker_social", ' . $general_settings[ 'cookie_days' ] . '); 
  92.  
  93. window.location.reload( true ); 
  94.  
  95. function gl_unlockcontent( social ) { 
  96. clearInterval(glTimerContent); 
  97. gl_createCookie("g_locker_' . $postID . '_content", ' . $general_settings[ 'cookie_days' ] . '); 
  98.  
  99. window.location.reload(true); 
  100.  
  101. function lock(className) { 
  102. var id = ""; 
  103. for ( i = 1; i <= ' . $count . '; i++ ) { 
  104. id = className + "-" + String(i); 
  105. var x = document.getElementById( id ); 
  106. if ( x ) { 
  107. x.style.display = "none"; 
  108. }  
  109. </script>  
  110. '; 
  111.  
  112. // Cookie 
  113. $script_footer = $script_footer . ' 
  114. <script type="text/javascript"> 
  115. function gl_createCookie(id, days) { 
  116. var d = new Date(); 
  117.  
  118. if ( days > 0 ) { 
  119. d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000)); 
  120. else { 
  121. d.setTime(d.getTime() + (24 * 60 * 60 * 1000)); 
  122.  
  123. var expires = "expires=" + d.toGMTString(); 
  124. document.cookie = id + "=true; " + expires; 
  125. </script>  
  126. '; 
  127.  
  128. // Effects 
  129. $script_footer = $script_footer . ' 
  130. <script> 
  131. function effectFadeToggle() { 
  132. jQuery(this).find("#g-locker-effect").stop(true, false).fadeToggle(); 
  133. function effectSlideToggle() { 
  134. jQuery(this).find("#g-locker-effect").stop(true, false).slideToggle(); 
  135. function effectToggle() { 
  136. jQuery(this).find("#g-locker-effect").stop(true, false).toggle("slow"); 
  137.  
  138. // for mouse down 
  139. function effectFadeToggleTimer() { 
  140. jQuery(this).find("#g-locker-effect").fadeToggle(); 
  141. jQuery(this).find("#g-locker-effect").delay( 1800 ).fadeToggle(); 
  142. function effectSlideToggleTimer() { 
  143. jQuery(this).find("#g-locker-effect").slideToggle(); 
  144. jQuery(this).find("#g-locker-effect").delay( 1800 ).slideToggle(); 
  145. function effectToggleTimer() { 
  146. jQuery(this).find("#g-locker-effect").toggle("slow"); 
  147. jQuery(this).find("#g-locker-effect").delay( 1800 ).toggle("slow"); 
  148.  
  149. jQuery( document ).ready( function() { 
  150. '; 
  151.  
  152. for ( $i = 1; $i <= $count; $i++ ) { 
  153. $script_footer = $script_footer . ' 
  154. jQuery( "#g-locker-google-one-fade-' . $i . '" ).hover( effectFadeToggle, effectFadeToggle ); 
  155. jQuery( "#g-locker-google-share-fade-' . $i . '" ).hover( effectFadeToggle, effectFadeToggle );  
  156. jQuery( "#g-locker-youtube-fade-' . $i . '" ).hover( effectFadeToggle, effectFadeToggle ); 
  157.  
  158. jQuery( "#g-locker-google-one-fade-' . $i . '" ).mousedown ( effectFadeToggleTimer ); 
  159. jQuery( "#g-locker-google-share-fade-' . $i . '" ).mousedown ( effectFadeToggleTimer ); 
  160. jQuery( "#g-locker-youtube-fade-' . $i . '" ).mousedown ( effectFadeToggleTimer ); 
  161.  
  162. //slide 
  163. jQuery( "#g-locker-google-one-slide-' . $i . '" ).hover( effectSlideToggle, effectSlideToggle ); 
  164. jQuery( "#g-locker-google-share-slide-' . $i . '" ).hover( effectSlideToggle, effectSlideToggle );  
  165. jQuery( "#g-locker-youtube-slide-' . $i . '" ).hover( effectSlideToggle, effectSlideToggle ); 
  166.  
  167. jQuery( "#g-locker-google-one-slide-' . $i . '" ).mousedown( effectSlideToggleTimer ); 
  168. jQuery( "#g-locker-google-share-slide-' . $i . '" ).mousedown( effectSlideToggleTimer );  
  169. jQuery( "#g-locker-youtube-slide-' . $i . '" ).mousedown( effectSlideToggleTimer ); 
  170.  
  171. //hide 
  172. jQuery( "#g-locker-google-one-hide-' . $i . '" ).hover( effectToggle, effectToggle ); 
  173. jQuery( "#g-locker-google-share-hide-' . $i . '" ).hover( effectToggle, effectToggle );  
  174. jQuery( "#g-locker-youtube-hide-' . $i . '" ).hover( effectToggle, effectToggle); 
  175.  
  176. jQuery( "#g-locker-google-one-hide-' . $i . '" ).mousedown( effectToggleTimer ); 
  177. jQuery( "#g-locker-google-share-hide-' . $i . '" ).mousedown( effectToggleTimer );  
  178. jQuery( "#g-locker-youtube-hide-' . $i . '" ).mousedown( effectToggleTimer ); 
  179. '; 
  180.  
  181. $script_footer = $script_footer . ' 
  182. }); 
  183. </script> 
  184. '; 
  185.  
  186. echo $script_footer;