gl_generate

Generate Google Locker.

Description

Parameters (5)

0. $content
The content.
1. $type
The type.
2. $googleurl
The googleurl.
3. $youtube_channel
The youtube channel.
4. $is_preview — Optional. (bool) => false
The is preview.

Usage

  1. if ( !function_exists( 'gl_generate' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-locker-for-wordpress/admin/shortcode.php'; 
  3.  
  4. // The content. 
  5. $content = null; 
  6.  
  7. // The type. 
  8. $type = null; 
  9.  
  10. // The googleurl. 
  11. $googleurl = null; 
  12.  
  13. // The youtube channel. 
  14. $youtube_channel = null; 
  15.  
  16. // The is preview. 
  17. $is_preview = false; 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = gl_generate($content, $type, $googleurl, $youtube_channel, $is_preview); 
  21.  

Defined (1)

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

/admin/shortcode.php  
  1. function gl_generate( $content, $type, $googleurl, $youtube_channel, $is_preview = false ) { 
  2. // General Values 
  3. $general_settings = gl_get_general_settings_values(); 
  4.  
  5. // Locker Values 
  6. $social_lock_settings = gl_get_social_lock_setting_values(); 
  7. $content_lock_settings = gl_get_content_lock_setting_values(); 
  8.  
  9. $title = $social_lock_settings[ 'sl_title' ]; 
  10. $message = $social_lock_settings[ 'sl_message' ]; 
  11. $style = $social_lock_settings[ 'sl_style' ]; 
  12. $title_color = $social_lock_settings[ 'sl_title_color' ]; 
  13. $message_color = $social_lock_settings[ 'sl_message_color' ]; 
  14. $bg_color = $social_lock_settings[ 'sl_bg_color' ]; 
  15. $shadow_color = $social_lock_settings[ 'sl_shadow_color' ]; 
  16. $button_layout = $social_lock_settings[ 'sl_layout' ]; 
  17. $button_effect = $social_lock_settings[ 'sl_btn_effect' ]; 
  18.  
  19. if ( $type == 'content' ) { 
  20. $title = $content_lock_settings[ 'cl_title' ]; 
  21. $message = $content_lock_settings[ 'cl_message' ]; 
  22. $style = $content_lock_settings[ 'cl_style' ]; 
  23. $title_color = $content_lock_settings[ 'cl_title_color' ]; 
  24. $message_color = $content_lock_settings[ 'cl_message_color' ]; 
  25. $bg_color = $content_lock_settings[ 'cl_bg_color' ]; 
  26. $shadow_color = $content_lock_settings[ 'cl_shadow_color' ]; 
  27. $button_layout = $content_lock_settings[ 'cl_layout' ]; 
  28. $button_effect = $content_lock_settings[ 'cl_btn_effect' ]; 
  29.  
  30. // Layout Button 
  31. if ( $button_layout == 'count' ) { 
  32. $gp_layout = 'medium'; 
  33. $gps_layout = 'bubble'; 
  34. $youtube_layout = 'horizontal'; 
  35. $height_button = 22; 
  36. } else if ( $button_layout == 'box' ) { 
  37. $gp_layout = 'tall'; 
  38. $gps_layout = 'vertical-bubble'; 
  39. $youtube_layout = 'vertical'; 
  40. $height_button = 65; 
  41.  
  42. // Only use "Round Style" with "Count Social Layout" 
  43. if ( $button_layout == 'box' && $style == 'round' ) 
  44. $style = 'corner'; 
  45.  
  46. // Create Locker 
  47. global $count; 
  48. $count = $count + 1;  
  49.  
  50. // Create Button Locks 
  51. if ( $general_settings[ 'google_active' ] ) { 
  52. $btn_locks = $btn_locks . ' 
  53. <div class="g-locker-' . $style . '-box" id="g-locker-google-one-' . $button_effect . '-' . $count . '"> 
  54. <a class="g-locker-' . $style . '-effect" id="g-locker-effect" style="line-height: normal;"> 
  55. <div class="g-locker-' . $style . '-icon-google"></div> 
  56. </a> 
  57. <div class="g-locker-' . $style . '-button" style="line-height: normal; height:' . $height_button .'px;"> 
  58. <div class="g-plusone" data-size="' . $gp_layout . '" data-callback="gl_unlock_g_' . $type . '" data-href="' . $googleurl . '"></div> 
  59. </div> 
  60. </div> 
  61. '; 
  62. if ( $general_settings[ 'google_share' ] ) { 
  63. $btn_locks = $btn_locks . ' 
  64. <div class="g-locker-' . $style . '-box" id="g-locker-google-share-' . $button_effect . '-' . $count . '"> 
  65. <a class="g-locker-' . $style . '-effect" id="g-locker-effect" style="line-height: normal;"> 
  66. <div class="g-locker-' . $style . '-icon-google"></div> 
  67. </a> 
  68. <div class="g-locker-' . $style . '-button" style="line-height: normal; height:' . $height_button .'px;"> 
  69. <div class="g-plus" data-action="share" data-annotation="' . $gps_layout . '" data-onstartinteraction="gl_unlock_g_share_start_' . $type . '" data-onendinteraction="gl_unlock_g_share_end_' . $type . '" data-href="' . $googleurl . '" ></div> 
  70. </div> 
  71. </div> 
  72. '; 
  73. if ( $general_settings[ 'youtube_active' ] ) { 
  74. if ( $youtube_layout == 'vertical') { 
  75. $counter = gl_get_counter_youtube( $youtube_channel ); 
  76. $btn_locks = $btn_locks . ' 
  77. <div class="g-locker-' . $style . '-box" id="g-locker-youtube-' . $button_effect . '-' . $count . '"> 
  78. <a class="g-locker-' . $style . '-effect" id="g-locker-effect" style="line-height: normal;"> 
  79. <div class="g-locker-' . $style . '-icon-youtube"></div> 
  80. </a> 
  81. <div class="g-locker-' . $style . '-button" style="line-height: normal; height:' . $height_button .'px;"> 
  82. <div class="box_counter_ver" style="width: 88px;" ><span id="followers">' . $counter . '</span></div> 
  83. <div class="g-ytsubscribe" data-channel="' . $youtube_channel .'" data-count="hidden" data-onytevent="gl_unlock_y_' . $type . '"></div> 
  84. </div> 
  85. </div> 
  86. '; 
  87. } else { 
  88. $btn_locks = $btn_locks . ' 
  89. <div class="g-locker-' . $style . '-box" id="g-locker-youtube-' . $button_effect . '-' . $count . '"> 
  90. <a class="g-locker-' . $style . '-effect" id="g-locker-effect" style="line-height: normal;"> 
  91. <div class="g-locker-' . $style . '-icon-youtube"></div> 
  92. </a> 
  93. <div class="g-locker-' . $style . '-button" style="line-height: normal; height:' . $height_button .'px;"> 
  94. <div class="g-ytsubscribe" data-channel="' . $youtube_channel .'" data-onytevent="gl_unlock_y_' . $type . '"></div> 
  95. </div> 
  96. </div> 
  97. '; 
  98.  
  99. // Google Locker all 
  100. // before 
  101. $gl_locker = $gl_locker . '<div class="g-locker-' . $type . ' g-locker-' . $style . '" id="g-locker-' . $type . '-' . $count . '" style="background-color:' . $bg_color . '; box-shadow:0 0 40px ' . $shadow_color . '; -webkit-box-shadow:0 0 40px ' . $shadow_color . ';"> 
  102. '; 
  103.  
  104. // buttons locker 
  105. $gl_locker = $gl_locker . ' 
  106. <div class="g-locker-' . $style . '-text"> 
  107. <div class="g-locker-' . $style . '-strong" style="color: ' . $title_color . ';">' . $title . '</div> 
  108. <div class="g-locker-' . $style . '-message" style="color: ' . $message_color . ';">' . $message . '</div> 
  109. </div> 
  110. <div class="g-locker-' . $style . '-buttons"> 
  111. ' . $btn_locks . ' 
  112. </div> 
  113. '; 
  114.  
  115. // after 
  116. $gl_locker = $gl_locker . ' 
  117. </div> 
  118. '; 
  119.  
  120. return $gl_locker;