/admin/pages.php

  1. <?php 
  2. /** 
  3. * Array Language 
  4. */  
  5. $languages = array( 
  6. array('ca_ES', __('Catalan', 'g_locker')),  
  7. array('cs_CZ', __('Czech', 'g_locker')),  
  8. array('cy_GB', __('Welsh', 'g_locker')),  
  9. array('da_DK', __('Danish', 'g_locker')),  
  10. array('de_DE', __('German', 'g_locker')),  
  11. array('eu_ES', __('Basque', 'g_locker')),  
  12. array('en_US', __('English', 'g_locker')),  
  13. array('es_ES', __('Spanish', 'g_locker')),  
  14. array('fi_FI', __('Finnish', 'g_locker')),  
  15. array('fr_FR', __('French', 'g_locker')),  
  16. array('gl_ES', __('Galician', 'g_locker')),  
  17. array('hu_HU', __('Hungarian', 'g_locker')),  
  18. array('it_IT', __('Italian', 'g_locker')),  
  19. array('ja_JP', __('Japanese', 'g_locker')),  
  20. array('ko_KR', __('Korean', 'g_locker')),  
  21. array('nb_NO', __('Norwegian', 'g_locker')),  
  22. array('nl_NL', __('Dutch', 'g_locker')),  
  23. array('pl_PL', __('Polish', 'g_locker')),  
  24. array('pt_BR', __('Portuguese (Brazil)', 'g_locker')),  
  25. array('pt_PT', __('Portuguese (Portugal)', 'g_locker')),  
  26. array('ro_RO', __('Romanian', 'g_locker')),  
  27. array('ru_RU', __('Russian', 'g_locker')),  
  28. array('sk_SK', __('Slovak', 'g_locker')),  
  29. array('sl_SI', __('Slovenian', 'g_locker')),  
  30. array('sv_SE', __('Swedish', 'g_locker')),  
  31. array('th_TH', __('Thai', 'g_locker')),  
  32. array('tr_TR', __('Turkish', 'g_locker')),  
  33. array('ku_TR', __('Kurdish', 'g_locker')),  
  34. array('zh_CN', __('Simplified Chinese (China)', 'g_locker')),  
  35. array('zh_HK', __('Traditional Chinese (Hong Kong)', 'g_locker')),  
  36. array('zh_TW', __('Traditional Chinese (Taiwan)', 'g_locker')),  
  37. array('af_ZA', __('Afrikaans', 'g_locker')),  
  38. array('sq_AL', __('Albanian', 'g_locker')),  
  39. array('hy_AM', __('Armenian', 'g_locker')),  
  40. array('az_AZ', __('Azeri', 'g_locker')),  
  41. array('be_BY', __('Belarusian', 'g_locker')),  
  42. array('bn_IN', __('Bengali', 'g_locker')),  
  43. array('bs_BA', __('Bosnian', 'g_locker')),  
  44. array('bg_BG', __('Bulgarian', 'g_locker')),  
  45. array('hr_HR', __('Croatian', 'g_locker')),  
  46. array('nl_BE', __('Dutch (Belgi*)', 'g_locker')),  
  47. array('eo_EO', __('Esperanto', 'g_locker')),  
  48. array('et_EE', __('Estonian', 'g_locker')),  
  49. array('fo_FO', __('Faroese', 'g_locker')),  
  50. array('ka_GE', __('Georgian', 'g_locker')),  
  51. array('el_GR', __('Greek', 'g_locker')),  
  52. array('gu_IN', __('Gujarati', 'g_locker')),  
  53. array('hi_IN', __('Hindi', 'g_locker')),  
  54. array('is_IS', __('Icelandic', 'g_locker')),  
  55. array('id_ID', __('Indonesian', 'g_locker')),  
  56. array('ga_IE', __('Irish', 'g_locker')),  
  57. array('jv_ID', __('Javanese', 'g_locker')),  
  58. array('kn_IN', __('Kannada', 'g_locker')),  
  59. array('kk_KZ', __('Kazakh', 'g_locker')),  
  60. array('la_VA', __('Latin', 'g_locker')),  
  61. array('lv_LV', __('Latvian', 'g_locker')),  
  62. array('li_NL', __('Limburgish', 'g_locker')),  
  63. array('lt_LT', __('Lithuanian', 'g_locker')),  
  64. array('mk_MK', __('Macedonian', 'g_locker')),  
  65. array('mg_MG', __('Malagasy', 'g_locker')),  
  66. array('ms_MY', __('Malay', 'g_locker')),  
  67. array('mt_MT', __('Maltese', 'g_locker')),  
  68. array('mr_IN', __('Marathi', 'g_locker')),  
  69. array('mn_MN', __('Mongolian', 'g_locker')),  
  70. array('ne_NP', __('Nepali', 'g_locker')),  
  71. array('pa_IN', __('Punjabi', 'g_locker')),  
  72. array('rm_CH', __('Romansh', 'g_locker')),  
  73. array('sa_IN', __('Sanskrit', 'g_locker')),  
  74. array('sr_RS', __('Serbian', 'g_locker')),  
  75. array('so_SO', __('Somali', 'g_locker')),  
  76. array('sw_KE', __('Swahili', 'g_locker')),  
  77. array('tl_PH', __('Filipino', 'g_locker')),  
  78. array('ta_IN', __('Tamil', 'g_locker')),  
  79. array('tt_RU', __('Tatar', 'g_locker')),  
  80. array('te_IN', __('Telugu', 'g_locker')),  
  81. array('ml_IN', __('Malayalam', 'g_locker')),  
  82. array('uk_UA', __('Ukrainian', 'g_locker')),  
  83. array('uz_UZ', __('Uzbek', 'g_locker')),  
  84. array('vi_VN', __('Vietnamese', 'g_locker')),  
  85. array('xh_ZA', __('Xhosa', 'g_locker')),  
  86. array('zu_ZA', __('Zulu', 'g_locker')),  
  87. array('km_KH', __('Khmer', 'g_locker')),  
  88. array('tg_TJ', __('Tajik', 'g_locker')),  
  89. array('ar_AR', __('Arabic', 'g_locker')),  
  90. array('he_IL', __('Hebrew', 'g_locker')),  
  91. array('ur_PK', __('Urdu', 'g_locker')),  
  92. array('fa_IR', __('Persian', 'g_locker')),  
  93. array('sy_SY', __('Syriac', 'g_locker')),  
  94. array('yi_DE', __('Yiddish', 'g_locker')),  
  95. array('gn_PY', __('Guaran*', 'g_locker')),  
  96. array('qu_PE', __('Quechua', 'g_locker')),  
  97. array('ay_BO', __('Aymara', 'g_locker')),  
  98. array('se_NO', __('Northern S*mi', 'g_locker')),  
  99. array('ps_AF', __('Pashto', 'g_locker')) 
  100. ); 
  101.  
  102. /** 
  103. * Registers the settings via the Settings API,  
  104. * appends the setting to the tabs array of the object. 
  105. */ 
  106. function gl_register_settings( ) { 
  107. register_setting( gl_get_general_settings_key(), gl_get_general_settings_key() ); 
  108.  
  109. // General  
  110. add_settings_section( 'section_social', 'Social', '__return_false', gl_get_general_settings_key() ); 
  111. add_settings_field( 'google_active', 'Google Plus Button', 'gl_field_googleActive', gl_get_general_settings_key(), 'section_social' ); 
  112. add_settings_field( 'google_share', 'Google Share Button', 'gl_field_google_share', gl_get_general_settings_key(), 'section_social' ); 
  113. add_settings_field( 'google_url', 'Google URL', 'gl_field_googleURL', gl_get_general_settings_key(), 'section_social' ); 
  114. add_settings_field( 'youtube_active', 'Display Youtube', 'gl_field_youtube_active', gl_get_general_settings_key(), 'section_social' ); 
  115. add_settings_field( 'youtube_channel', 'Youtube Channel', 'gl_field_youtube_channel', gl_get_general_settings_key(), 'section_social' ); 
  116.  
  117. add_settings_section( 'section_advance', 'Advance', '__return_false', gl_get_general_settings_key() ); 
  118. add_settings_field( 'language', 'Language', 'gl_field_languages', gl_get_general_settings_key(), 'section_advance' ); 
  119. add_settings_field( 'cookie_days', 'Cookie', 'gl_field_cookieDays', gl_get_general_settings_key(), 'section_advance' ); 
  120.  
  121. // Social locker 
  122. register_setting( gl_get_social_lock_settings_key(), gl_get_social_lock_settings_key() ); 
  123. add_settings_section( 'section_social_lock', 'Social Locker Settings', '__return_false', gl_get_social_lock_settings_key() ); 
  124. add_settings_field( 'sl_title', 'Title', 'gl_field_sl_title', gl_get_social_lock_settings_key(), 'section_social_lock' ); 
  125. add_settings_field( 'sl_message', 'Message', 'gl_field_sl_message', gl_get_social_lock_settings_key(), 'section_social_lock' ); 
  126.  
  127. add_settings_section( 'section_theme', 'Theme Options', '__return_false', gl_get_social_lock_settings_key() ); 
  128. add_settings_field( 'sl_style', 'Style', 'gl_field_sl_style', gl_get_social_lock_settings_key(), 'section_theme' ); 
  129. add_settings_field( 'sl_title_color', 'Title Color', 'gl_field_sl_title_color', gl_get_social_lock_settings_key(), 'section_theme' ); 
  130. add_settings_field( 'sl_message_color', 'Message Color', 'gl_field_sl_message_color', gl_get_social_lock_settings_key(), 'section_theme' ); 
  131. add_settings_field( 'sl_bg_color', 'Background Color', 'gl_field_sl_bg_color', gl_get_social_lock_settings_key(), 'section_theme' ); 
  132. add_settings_field( 'sl_shadow_color', 'Shadow Color', 'gl_field_sl_shadow_color', gl_get_social_lock_settings_key(), 'section_theme' ); 
  133. add_settings_field( 'sl_layout', 'Social Layout', 'gl_field_sl_layout', gl_get_social_lock_settings_key(), 'section_theme' ); 
  134. add_settings_field( 'sl_btn_effect', 'Social Button Effect', 'gl_field_sl_btn_effect', gl_get_social_lock_settings_key(), 'section_theme' ); 
  135.  
  136. add_settings_field( 'preview', 'Preview', 'gl_field_preview_social', gl_get_social_lock_settings_key(), 'section_theme' ); 
  137.  
  138. // Content locker 
  139. register_setting( gl_get_content_lock_settings_key(), gl_get_content_lock_settings_key() ); 
  140. add_settings_section( 'section_content_lock', 'Content Locker Settings', '__return_false', gl_get_content_lock_settings_key() ); 
  141. add_settings_field( 'cl_title', 'Title', 'gl_field_cl_title', gl_get_content_lock_settings_key(), 'section_content_lock' ); 
  142. add_settings_field( 'cl_message', 'Message', 'gl_field_cl_message', gl_get_content_lock_settings_key(), 'section_content_lock' ); 
  143.  
  144. add_settings_section( 'section_theme', 'Theme Options', '__return_false', gl_get_content_lock_settings_key() ); 
  145. add_settings_field( 'cl_style', 'Style', 'gl_field_cl_style', gl_get_content_lock_settings_key(), 'section_theme' ); 
  146. add_settings_field( 'cl_title_color', 'Title Color', 'gl_field_cl_title_color', gl_get_content_lock_settings_key(), 'section_theme' ); 
  147. add_settings_field( 'cl_message_color', 'Message Color', 'gl_field_cl_message_color', gl_get_content_lock_settings_key(), 'section_theme' ); 
  148. add_settings_field( 'cl_bg_color', 'Background Color', 'gl_field_cl_bg_color', gl_get_content_lock_settings_key(), 'section_theme' ); 
  149. add_settings_field( 'cl_shadow_color', 'Shadow Color', 'gl_field_cl_shadow_color', gl_get_content_lock_settings_key(), 'section_theme' ); 
  150. add_settings_field( 'cl_layout', 'Social Layout', 'gl_field_cl_layout', gl_get_content_lock_settings_key(), 'section_theme' ); 
  151. add_settings_field( 'cl_btn_effect', 'Social Button Effect', 'gl_field_cl_btn_effect', gl_get_content_lock_settings_key(), 'section_theme' ); 
  152.  
  153. add_settings_field( 'preview', 'Preview', 'gl_field_preview_content', gl_get_content_lock_settings_key(), 'section_theme' ); 
  154.  
  155. // How to use 
  156. register_setting( gl_get_howtouse_settings_key(), gl_get_howtouse_settings_key() ); 
  157.  
  158. /** 
  159. * General Option field callback 
  160. */ 
  161. function gl_field_checkbox( $settings_values, $settings_key, $key, $short_desc = null, $desc = null ) { 
  162. ?> 
  163. <input type="checkbox" name="<?php echo $settings_key; ?>[<?php echo $key; ?>]" value="1" <?php echo esc_attr( $settings_values[$key]? "checked" : "" ); ?>> <?php if ( $short_desc ) echo $short_desc; ?><br><br> 
  164. <span style="color:#999"><em><?php if ( $desc ) echo $desc; ?></em></span> 
  165. <?php 
  166.  
  167. function gl_field_text($settings_values, $settings_key, $key, $isColor = false, $short_desc = null, $desc = null) { 
  168. ?> 
  169. <input type="text" name="<?php echo $settings_key; ?>[<?php echo $key; ?>]" value="<?php echo esc_attr( $settings_values[$key] ); ?>" <?php if ( $isColor == true) echo 'class="color-field"'; ?> style="width:350px" /> <?php if ( $short_desc ) echo $short_desc; ?><br><br> 
  170. <span style="color:#999"><em><?php if ( $desc ) echo $desc; ?></em></span> 
  171. <?php 
  172.  
  173. function gl_field_googleActive( ) { 
  174. gl_field_checkbox( gl_get_general_settings_values(), gl_get_general_settings_key(), 'google_active', 'Activate/Deactivate' ); 
  175.  
  176. function gl_field_google_share( ) { 
  177. gl_field_checkbox( gl_get_general_settings_values(), gl_get_general_settings_key(), 'google_share', 'Activate/Deactivate' ); 
  178.  
  179. function gl_field_googleURL( ) { 
  180. gl_field_text( gl_get_general_settings_values(), gl_get_general_settings_key(), 'google_url', false, null, 'Insert the URL which you want to share or follow. Example: http://www.wptpnet' ); 
  181.  
  182. function gl_field_youtube_active( ) { 
  183. gl_field_checkbox( gl_get_general_settings_values(), gl_get_general_settings_key(), 'youtube_active', 'Activate/Deactivate', 'Only support Youtube for Social Locker' ); 
  184.  
  185. function gl_field_youtube_channel( ) { 
  186. gl_field_text( gl_get_general_settings_values(), gl_get_general_settings_key(), 'youtube_channel', false, null, 'Insert the YouTube channel. Example: GoogleDevelopers' ); 
  187.  
  188. function gl_field_languages( ) { 
  189. global $languages; 
  190.  
  191. $general_settings = gl_get_general_settings_values(); 
  192. ?> 
  193. <select name="<?php echo gl_get_general_settings_key(); ?>[language]" id="<?php echo esc_attr( $general_settings[ 'language' ] ); ?>"> 
  194. <?php foreach( $languages as $lang ) {?> 
  195. <option value="<?php echo $lang[0] ?>" <?php if ( $general_settings[ 'language' ] == $lang[0] ) { echo 'selected="selected"'; } ?>><?php echo $lang[1] ?></option> 
  196. <?php }?> 
  197. </select><br><br> 
  198. <span style="color:#999"><em>Language for all Social</em></span> 
  199. <?php 
  200.  
  201. function gl_field_cookieDays( ) { 
  202. gl_field_text( gl_get_general_settings_values(), gl_get_general_settings_key(), 'cookie_days', false, 'days', 'Default: 1 day.' ); 
  203.  
  204. /** 
  205. * Social Locker Option field callback 
  206. */ 
  207. function gl_field_sl_title( ) { 
  208. gl_field_text( gl_get_social_lock_setting_values(), gl_get_social_lock_settings_key(), 'sl_title' ); 
  209.  
  210. function gl_field_sl_message( ) { 
  211. $social_lock_settings = gl_get_social_lock_setting_values(); 
  212. ?> 
  213. <textarea rows="4" cols="50" name="<?php echo gl_get_social_lock_settings_key(); ?>[sl_message]"><?php echo esc_attr( $social_lock_settings[ 'sl_message' ] ); ?></textarea> 
  214. <?php 
  215.  
  216. function gl_field_sl_style() { 
  217. $social_lock_settings = gl_get_social_lock_setting_values(); 
  218. ?> 
  219. <select name="<?php echo gl_get_social_lock_settings_key(); ?>[sl_style]" id="<?php echo esc_attr( $social_lock_settings[ 'sl_style' ] ); ?>"> 
  220. <option value="starter" <?php if ( $social_lock_settings[ 'sl_style' ] == 'starter' ) { echo 'selected="selected"'; } ?>>Starter</option> 
  221. <option value="corner" <?php if( $social_lock_settings[ 'sl_style' ] == 'corner' ) { echo 'selected="selected"'; } ?>>Corner</option> 
  222. <option value="round" <?php if( $social_lock_settings[ 'sl_style' ] == 'round' ) { echo 'selected="selected"'; } ?>>Round</option> 
  223. </select><br><br> 
  224. <span style="color:#999"><em>Only use "Round Style" with "Count Social Layout"</em></span> 
  225. <?php 
  226.  
  227. function gl_field_sl_title_color( ) { 
  228. gl_field_text( gl_get_social_lock_setting_values(), gl_get_social_lock_settings_key(), 'sl_title_color', true, null, 'Title text color' ); 
  229.  
  230. function gl_field_sl_message_color( ) { 
  231. gl_field_text( gl_get_social_lock_setting_values(), gl_get_social_lock_settings_key(), 'sl_message_color', true, null, 'Message text color' ); 
  232.  
  233. function gl_field_sl_bg_color( ) { 
  234. gl_field_text( gl_get_social_lock_setting_values(), gl_get_social_lock_settings_key(), 'sl_bg_color', true ); 
  235.  
  236. function gl_field_sl_shadow_color( ) { 
  237. gl_field_text( gl_get_social_lock_setting_values(), gl_get_social_lock_settings_key(), 'sl_shadow_color', true ); 
  238. function gl_field_sl_layout() { 
  239. $social_lock_settings = gl_get_social_lock_setting_values(); 
  240. ?> 
  241. <select name="<?php echo gl_get_social_lock_settings_key(); ?>[sl_layout]" id="<?php echo esc_attr( $social_lock_settings[ 'sl_layout' ] ); ?>"> 
  242. <option value="count" <?php if ( $social_lock_settings[ 'sl_layout' ] == 'count' ) { echo 'selected="selected"'; } ?>>Count</option> 
  243. <option value="box" <?php if ( $social_lock_settings[ 'sl_layout' ] == 'box' ) { echo 'selected="selected"'; } ?>>Box</option> 
  244. </select> 
  245. <?php 
  246.  
  247. function gl_field_sl_btn_effect( ) { 
  248. $social_lock_settings = gl_get_social_lock_setting_values(); 
  249. ?> 
  250. <select name="<?php echo gl_get_social_lock_settings_key(); ?>[sl_btn_effect]" id="<?php echo esc_attr( $social_lock_settings[ 'sl_btn_effect' ] ); ?>"> 
  251. <option value="fade" <?php if ( $social_lock_settings[ 'sl_btn_effect' ] == 'fade' ) { echo 'selected="selected"'; } ?>>Fade</option> 
  252. <option value="slide" <?php if ( $social_lock_settings[ 'sl_btn_effect' ] == 'slide' ) { echo 'selected="selected"'; } ?>>Slide</option> 
  253. <option value="hide" <?php if ( $social_lock_settings[ 'sl_btn_effect' ] == 'hide' ) { echo 'selected="selected"'; } ?>>Hide/Show</option> 
  254. </select> 
  255. <?php 
  256.  
  257. /** 
  258. * Content Locker Option field callback 
  259. */ 
  260. function gl_field_cl_title( ) { 
  261. gl_field_text( gl_get_content_lock_setting_values(), gl_get_content_lock_settings_key(), 'cl_title' ); 
  262.  
  263. function gl_field_cl_message( ) { 
  264. $content_lock_settings = gl_get_content_lock_setting_values(); 
  265. ?> 
  266. <textarea rows="4" cols="50" name="<?php echo gl_get_content_lock_settings_key(); ?>[cl_message]"><?php echo esc_attr( $content_lock_settings[ 'cl_message' ] ); ?></textarea> 
  267. <?php 
  268.  
  269. function gl_field_cl_style() { 
  270. $content_lock_settings = gl_get_content_lock_setting_values(); 
  271. ?> 
  272. <select name="<?php echo gl_get_content_lock_settings_key(); ?>[cl_style]" id="<?php echo esc_attr( $content_lock_settings[ 'cl_style' ] ); ?>"> 
  273. <option value="starter" <?php if ( $content_lock_settings[ 'cl_style' ] == 'starter' ) { echo 'selected="selected"'; } ?>>Starter</option> 
  274. <option value="corner" <?php if ( $content_lock_settings[ 'cl_style' ] == 'corner' ) { echo 'selected="selected"'; } ?>>Corner</option> 
  275. <option value="round" <?php if ( $content_lock_settings[ 'cl_style' ] == 'round' ) { echo 'selected="selected"'; } ?>>Round</option> 
  276. </select><br><br> 
  277. <span style="color:#999"><em>Only use "Round Style" with "Count Social Layout"</em></span> 
  278. <?php 
  279.  
  280. function gl_field_cl_title_color( ) { 
  281. gl_field_text( gl_get_content_lock_setting_values(), gl_get_content_lock_settings_key(), 'cl_title_color', true, null, 'Title text color' ); 
  282.  
  283. function gl_field_cl_message_color( ) { 
  284. gl_field_text( gl_get_content_lock_setting_values(), gl_get_content_lock_settings_key(), 'cl_message_color', true, null, 'Message text color' ); 
  285.  
  286. function gl_field_cl_bg_color( ) { 
  287. gl_field_text( gl_get_content_lock_setting_values(), gl_get_content_lock_settings_key(), 'cl_bg_color', true ); 
  288.  
  289. function gl_field_cl_shadow_color( ) { 
  290. gl_field_text( gl_get_content_lock_setting_values(), gl_get_content_lock_settings_key(), 'cl_shadow_color', true ); 
  291.  
  292. function gl_field_cl_layout( ) { 
  293. $content_lock_settings = gl_get_content_lock_setting_values(); 
  294. ?> 
  295. <select name="<?php echo gl_get_content_lock_settings_key(); ?>[cl_layout]" id="<?php echo esc_attr( $content_lock_settings[ 'cl_layout' ] ); ?>"> 
  296. <option value="count" <?php if ( $content_lock_settings[ 'cl_layout' ] == 'count' ) { echo 'selected="selected"'; } ?>>Count</option> 
  297. <option value="box" <?php if ( $content_lock_settings[ 'cl_layout' ] == 'box' ) { echo 'selected="selected"'; } ?>>Box</option> 
  298. </select> 
  299. <?php 
  300.  
  301. function gl_field_cl_btn_effect( ) { 
  302. $content_lock_settings = gl_get_content_lock_setting_values(); 
  303. ?> 
  304. <select name="<?php echo gl_get_content_lock_settings_key(); ?>[cl_btn_effect]" id="<?php echo esc_attr( $content_lock_settings[ 'cl_btn_effect' ] ); ?>"> 
  305. <option value="fade" <?php if ( $content_lock_settings[ 'cl_btn_effect' ] == 'fade' ) { echo 'selected="selected"'; } ?>>Fade</option> 
  306. <option value="slide" <?php if ( $content_lock_settings[ 'cl_btn_effect' ] == 'slide' ) { echo 'selected="selected"'; } ?>>Slide</option> 
  307. <option value="hide" <?php if ( $content_lock_settings[ 'cl_btn_effect' ] == 'hide' ) { echo 'selected="selected"'; } ?>>Hide/Show</option> 
  308. </select> 
  309. <?php 
  310.  
  311. /** 
  312. * Preview field callback 
  313. */ 
  314. function gl_field_preview_social( ) { 
  315. echo gl_generate( "This is preview text", "social", "http://www.wptp.net", "GoogleDevelopers", true ); 
  316.  
  317. function gl_field_preview_content( ) { 
  318. echo gl_generate( "This is preview text", "content", "http://www.wptp.net", "GoogleDevelopers", true ); 
  319.  
  320. /** 
  321. * Called during admin_menu, adds an options 
  322. * page under Settings called Google Locker, rendered 
  323. * using the gl_plugin_options_page method. 
  324. */ 
  325. function gl_add_admin_menus( ) { 
  326. add_options_page( 'Google Locker', 'Google Locker', 'manage_options', gl_get_plugin_options_key(), 'gl_plugin_options_page' ); 
  327.  
  328. /** 
  329. * Plugin How to use tab 
  330. */ 
  331. function gl_plugin_howtouse_tab( ) { 
  332. echo ' 
  333. <h3 style="text-align:center" >Thank you for choosing Google Locker plugin by WPTP Net!</h3> 
  334. <p> 
  335.  </p> 
  336. <h3>Settings Page</h3><hr class="notop"> 
  337. <p> 
  338. The settings page allows you to configure some global options used with Google Locker.</p> 
  339. <p> 
  340.  </p> 
  341. <p> 
  342. <strong>General Settings</strong></p> 
  343. <p> 
  344. Google Plus Button - Turn on / off the google +1 button.</p> 
  345. <p> 
  346. Google Share Button - Turn on / off the google share button.</p> 
  347. <p> 
  348. Google URL - Insert the URL which you want to share or follow. Example: http://www.wptpnet.</p> 
  349. <p> 
  350. Display Youtube - Turn on / off the youtube subscribe button.</p> 
  351. <p> 
  352. Youtube Channel - Insert the YouTube channel. Example: GoogleDevelopers.</p> 
  353. <p> 
  354. Language - Choose language that you want use with Google/Youtube buttons.</p> 
  355. <p> 
  356. Cookie - The plugin use cookie remember users who have already unlocked.</p> 
  357. <p> 
  358.  </p> 
  359. <p> 
  360. <strong>Social/Content Settings</strong></p> 
  361. <p> 
  362. Title - You can change text for Title Locker here</p> 
  363. <p> 
  364. Message - You can change text for Message Lockerhere</p> 
  365. <p> 
  366. Style - You can change style of Locker here</p> 
  367. <p> 
  368. Social Layout - Support vertical (count) and horizontal (box) for counter here.</p> 
  369. <p> 
  370. Social Button Effect - Support 3 effects of Jquery (Fade/Slide/Hide & show)</p> 
  371. <p> 
  372. Preview - You can see preview for Social/Content locker.</p> 
  373. <p> 
  374.  </p> 
  375. <p> 
  376.  </p> 
  377. <h3>How to Use Google Locker</h3><hr class="notop"> 
  378. <p> 
  379. When creating a post / page you will see a new icon in your tinyMCE toolbar post editor. That is split buttons with 3 options Social, Content Locker.</p> 
  380. <p> 
  381.  </p>  
  382. <p> 
  383. <strong>How to Create A Content Locker</strong></p> 
  384. <p> 
  385. 1. Select the content in the post editor that you want to lock inside.</p> 
  386. <p> 
  387. 2. Click the lock icon. You can choose Social, Content button to insert ShortCode to content locker.</p> 
  388. '; 
  389.  
  390. /** 
  391. * Plugin Options page: using the gl_plugin_options_tabs method to render the tabs. 
  392. */  
  393. function gl_plugin_options_page( ) { 
  394. // Options page 
  395. $tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : gl_get_general_settings_key(); 
  396.  
  397. // Get options value after user press "Save Settings" button 
  398. $update_settings = isset( $_GET[ "settings-updated" ] ) ? $_GET[ "settings-updated" ] : ""; 
  399. if ( $update_settings == "true" ) {  
  400. $general_settings = gl_get_general_settings_values(); 
  401. $parts = explode('_', $general_settings[ 'language' ]); 
  402. $general_settings = array_merge( $general_settings, array( 
  403. 'short_language' => $parts[0] 
  404. ) ); 
  405.  
  406. delete_option( gl_get_general_settings_key() ); 
  407. update_option( gl_get_general_settings_key(), $general_settings ); 
  408.  
  409. // reset settings 
  410. $reset_settings = isset( $_GET[ "reset" ] ) ? $_GET[ "reset" ] : ""; 
  411. if ( $reset_settings == "true" ) {  
  412. if ( $tab == gl_get_general_settings_key() ) { 
  413. delete_option( gl_get_general_settings_key() ); 
  414. update_option( gl_get_general_settings_key(), gl_general_default_settings() ); 
  415.  
  416. $msg = "Reset General Settings Successfully."; 
  417. } else if ( $tab == gl_get_social_lock_settings_key() ) { 
  418. delete_option( gl_get_social_lock_settings_key() ); 
  419. update_option( gl_get_social_lock_settings_key(), gl_social_lock_default_settings() ); 
  420.  
  421. $msg = "Reset Social Locker Settings Successfully."; 
  422. } else if ( $tab == gl_get_content_lock_settings_key() ) { 
  423. delete_option( gl_get_content_lock_settings_key() ); 
  424. update_option( gl_get_content_lock_settings_key(), gl_content_lock_default_settings() ); 
  425.  
  426. $msg = "Reset Content Locker Settings Successfully."; 
  427. } else if ( $tab == gl_get_time_lock_settings_key() ) { 
  428. delete_option( gl_get_time_lock_settings_key() ); 
  429. update_option( gl_get_time_lock_settings_key(), gl_time_lock_default_settings() ); 
  430.  
  431. $msg = "Reset Time Locker Settings Successfully."; 
  432. ?> 
  433. <div class="wrap"> 
  434. <?php gl_plugin_options_tabs(); ?> 
  435. <?php if ($msg != "") { 
  436. echo '<div class="updated" style="padding: 10px;">' . $msg . '</div>'; 
  437. ?> 
  438. <form method="post" action="options.php"> 
  439. <?php if ( $tab == gl_get_howtouse_settings_key() ) { 
  440. echo gl_plugin_howtouse_tab(); 
  441. }  
  442. else { 
  443. ?> 
  444. <?php wp_nonce_field( 'update-options' ); ?> 
  445. <?php settings_fields( $tab ); ?> 
  446. <?php do_settings_sections( $tab ); ?> 
  447. <a href="options-general.php?page=<?php echo gl_get_plugin_options_key(); ?>&tab=<?php echo $tab ?>&reset=true" class="button">Reset configuration to default values</a> 
  448. <input type="submit" name="submit" id="submit" class="button-primary" value="Save settings" > 
  449. <?php } ?> 
  450. </form> 
  451. </div> 
  452. <?php 
  453.  
  454. /** 
  455. * Renders our tabs in the Plugin Options page 
  456. */  
  457. function gl_plugin_options_tabs( ) { 
  458. $current_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : gl_get_general_settings_key(); 
  459.  
  460. screen_icon(); 
  461. echo '<h2 class="nav-tab-wrapper">'; 
  462.  
  463. $plugin_settings_tabs = gl_get_plugin_settings_tabs(); 
  464. foreach ( $plugin_settings_tabs as $tab_key => $tab_caption ) { 
  465. $active = $current_tab == $tab_key ? 'nav-tab-active' : ''; 
  466. echo '<a class="nav-tab ' . $active . '" href="?page=' . gl_get_plugin_options_key() . '&tab=' . $tab_key . '">' . $tab_caption . '</a>'; 
  467. echo '</h2>'; 
  468.  
  469. /** 
  470. * Add Settings, Admin Menu, Header & Footer to WordPress 
  471. */ 
  472. add_action( 'admin_init', 'gl_register_settings' ); 
  473. add_action( 'admin_menu', 'gl_add_admin_menus' ); 
  474. add_action( 'admin_footer', 'gl_get_script_footer'); 
  475. ?> 
.