/google-plus-one.php

  1. <?php 
  2. /**## 
  3. Plugin Name: Google +1 by BestWebSoft 
  4. Plugin URI: http://bestwebsoft.com/products/wordpress/plugins/google-plus-one/ 
  5. Description: Add Google +1 Share, Follow, Hangout buttons and profile badge to WordPress posts, pages and widgets. 
  6. Author: BestWebSoft 
  7. Text Domain: google-one 
  8. Domain Path: /languages 
  9. Version: 1.3.4 
  10. Author URI: http://bestwebsoft.com 
  11. License: GPLv2 or later 
  12. */ 
  13.  
  14. /** @ Copyright 2017 BestWebSoft ( http://support.bestwebsoft.com ) 
  15.   
  16. This program is free software; you can redistribute it and/or modify 
  17. it under the terms of the GNU General Public License, version 2, as 
  18. published by the Free Software Foundation. 
  19.   
  20. This program is distributed in the hope that it will be useful,  
  21. but WITHOUT ANY WARRANTY; without even the implied warranty of 
  22. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
  23. GNU General Public License for more details. 
  24.   
  25. You should have received a copy of the GNU General Public License 
  26. along with this program; if not, write to the Free Software 
  27. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 
  28. */ 
  29.  
  30. /** Add BWS menu */ 
  31. if ( ! function_exists( 'gglplsn_admin_menu' ) ) { 
  32. function gglplsn_admin_menu() { 
  33. bws_general_menu(); 
  34. $settings = add_submenu_page( 'bws_panel', __( 'Google +1 Settings', 'google-one' ), 'Google +1', 'manage_options', "google-plus-one.php", 'gglplsn_options' ); 
  35. add_action( 'load-' . $settings, 'gglplsn_add_tabs' ); 
  36. /** end gglplsn_admin_menu ##*/ 
  37.  
  38. if ( ! function_exists( 'gglplsn_plugins_loaded' ) ) { 
  39. function gglplsn_plugins_loaded() { 
  40. /** Internationalization, first(!) */ 
  41. load_plugin_textdomain( 'google-one', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 
  42.  
  43. if ( ! function_exists ( 'gglplsn_init' ) ) { 
  44. function gglplsn_init() { 
  45. global $gglplsn_plugin_info, $gglplsn_lang_codes; 
  46.  
  47. if ( empty( $gglplsn_plugin_info ) ) { 
  48. if ( ! function_exists( 'get_plugin_data' ) ) 
  49. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  50. $gglplsn_plugin_info = get_plugin_data( __FILE__ ); 
  51.  
  52. /**## add general functions */ 
  53. require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' ); 
  54. bws_include_init( plugin_basename( __FILE__ ) ); 
  55. bws_wp_min_version_check( plugin_basename( __FILE__ ), $gglplsn_plugin_info, '3.8' );/** check compatible with current WP version ##*/ 
  56.  
  57. /** Get/Register and check settings for plugin */ 
  58. if ( ! is_admin() || ( isset( $_GET['page'] ) && ( "google-plus-one.php" == $_GET['page'] || "social-buttons.php" == $_GET['page'] ) ) ) { 
  59. gglplsn_settings(); 
  60. $gglplsn_lang_codes = array( 
  61. 'af' => "Afrikaans", 'am' => "Amharic", 'ar' => "Arabic", 'eu' => "Basque", 'bn' => "Bengali", 'bg' => "Bulgarian", 'ca' => "Catalan", 'zh-HK' => "Chinese (Hong Kong)", 'zh-CN' => "Chinese (Simplified)", 'zh-TW' => "Chinese (Traditional)", 'hr' => "Croatian", 'cs' => "Czech", 'da' => "Danish", 'nl' => "Dutch", 'en-GB' => "English (UK)", 'en' => "English (US)", 'et' => "Estonian", 'fil' => "Filipino", 'fi' => "Finnish", 'fr' => "French", 'fr-CA' => "French (Canadian)", 'gl' => "Galician", 'de' => "German", 'el' => "Greek", 'gu' => "Gujarati", 'iw' => "Hebrew", 'hi' => "Hindi", 'hu' => "Hungarian", 'is' => "Icelandic", 'id' => "Indonesian", 'it' => "Italian", 'ja' => "Japanese", 'kn' => "Kannada", 'ko' => "Korean", 'lv' => "Latvian", 'lt' => "Lithuanian", 'ms' => "Malay", 'ml' => "Malayalam", 'mr' => "Marathi", 'no' => "Norwegian", 'fa' => "Persian", 'pl' => "Polish", 'pt-BR' => "Portuguese (Brazil)", 'pt-PT' => "Portuguese (Portugal)", 'ro' => "Romanian", 'ru' => "Russian", 'sr' => "Serbian", 'sk' => "Slovak", 'sl' => "Slovenian", 'es' => "Spanish", 'es-419' => "Spanish (Latin America)", 'sw' => "Swahili", 'sv' => "Swedish", 'ta' => "Tamil", 'te' => "Telugu", 'th' => "Thai", 'tr' => "Turkish", 'uk' => "Ukrainian", 'ur' => "Urdu", 'vi' => "Vietnamese", 'zu' => "Zulu" 
  62. ); 
  63.  
  64. /** Function for admin_init */ 
  65. if ( ! function_exists( 'gglplsn_admin_init' ) ) { 
  66. function gglplsn_admin_init() { 
  67. global $bws_plugin_info, $gglplsn_plugin_info, $bws_shortcode_list; 
  68.  
  69. /**## Function for bws menu */ 
  70. if ( empty( $bws_plugin_info ) ) 
  71. $bws_plugin_info = array( 'id' => '102', 'version' => $gglplsn_plugin_info['Version'] ); 
  72.  
  73. /** add Google +1 to global $bws_shortcode_list ##*/ 
  74. $bws_shortcode_list['gglplsn'] = array( 'name' => 'Google +1', 'js_function' => 'gglplsn_shortcode_init' ); 
  75.  
  76. if ( ! function_exists ( 'gglplsn_settings' ) ) { 
  77. function gglplsn_settings() { 
  78. global $gglplsn_options, $gglplsn_plugin_info, $gglplsn_option_defaults; 
  79.  
  80. /** Default options */ 
  81. $gglplsn_option_defaults = array( 
  82. 'plugin_option_version' => $gglplsn_plugin_info['Version'],  
  83. 'plus_one_js' => 1,  
  84. 'plus_one_annotation' => 'none',  
  85. 'plus_one_size' => 'standard',  
  86. 'plus_one_annotation_type' => 'standard',  
  87. 'share_js' => 0,  
  88. 'share_size' => 20,  
  89. 'share_annotation' => 'none',  
  90. 'share_annotation_type' => 'standard',  
  91. 'follow_js' => 0,  
  92. 'follow_size' => 20,  
  93. 'follow_annotation' => 'none',  
  94. 'follow_relationship' => 'author',  
  95. 'follow_id' => '',  
  96. 'hangout_js' => 0,  
  97. 'hangout_topic' => '',  
  98. 'hangout_topic_title' => 1,  
  99. 'hangout_size' => 'standard',  
  100. 'hangout_type' => 'normal',  
  101. 'hangout_invite_type' => array(),  
  102. 'hangout_invite_id' => array(),  
  103. 'badge_js' => 0,  
  104. 'badge_type' => 'person',  
  105. 'badge_id' => '',  
  106. 'badge_layout' => 'portrait',  
  107. 'badge_show_cover' => false,  
  108. 'badge_show_tagline' => false,  
  109. 'badge_show_owners' => false,  
  110. 'badge_theme' => 'light',  
  111. 'badge_width' => 300,  
  112. 'position' => 'before_post',  
  113. 'posts' => 1,  
  114. 'pages' => 1,  
  115. 'homepage' => 1,  
  116. 'lang' => 'en',  
  117. 'use_multilanguage_locale' => 0,  
  118. 'display_settings_notice' => 1,  
  119. 'first_install' => strtotime( "now" ),  
  120. 'suggest_feature_banner' => 1 
  121. ); 
  122.  
  123. if ( ! get_option( 'gglplsn_options' ) ) 
  124. add_option( 'gglplsn_options', $gglplsn_option_defaults ); 
  125.  
  126. $gglplsn_options = get_option( 'gglplsn_options' ); 
  127.  
  128. if ( ! isset( $gglplsn_options['plugin_option_version'] ) || $gglplsn_options['plugin_option_version'] != $gglplsn_plugin_info["Version"] ) { 
  129.  
  130. /** 
  131. * @deprecated since 1.2.8 
  132. * @todo remove 
  133. */ 
  134. if ( isset( $gglplsn_options['annotation'] ) ) { 
  135. if ( is_numeric( $gglplsn_options['annotation'] ) ) { 
  136. $gglplsn_options['plus_one_annotation'] = 1 == $gglplsn_options['annotation'] ? 'bubble' : 'none' ; 
  137. } else { 
  138. $gglplsn_options['plus_one_annotation'] = $gglplsn_options['annotation']; 
  139.  
  140. unset( $gglplsn_options['annotation'] ); 
  141.  
  142. /** 
  143. * @deprecated since 1.2.8 
  144. * @todo remove 
  145. */ 
  146. if ( isset( $gglplsn_options['js'] ) ) { 
  147. $gglplsn_options['plus_one_js'] = $gglplsn_options['js']; 
  148. $gglplsn_options['plus_one_size'] = $gglplsn_options['size']; 
  149. unset( $gglplsn_options['js'] ); 
  150. unset( $gglplsn_options['size'] ); 
  151.  
  152. $gglplsn_option_defaults['display_settings_notice'] = 0; 
  153. $gglplsn_options = array_merge( $gglplsn_option_defaults, $gglplsn_options ); 
  154. $gglplsn_options['plugin_option_version'] = $gglplsn_plugin_info["Version"]; 
  155. /** show pro features */ 
  156. $gglplsn_options['hide_premium_options'] = array(); 
  157.  
  158. update_option( 'gglplsn_options', $gglplsn_options ); 
  159. gglplsn_plugin_activate(); 
  160.  
  161. /** Add settings page in admin area */ 
  162. if ( ! function_exists( 'gglplsn_options' ) ) { 
  163. function gglplsn_options() { 
  164. global $gglplsn_options, $wp_version, $gglplsn_plugin_info, $gglplsn_option_defaults, $gglplsn_lang_codes; 
  165.  
  166. $message = $error = ""; 
  167. $plugin_basename = plugin_basename( __FILE__ ); 
  168.  
  169. if ( ! function_exists( 'get_plugins' ) || ! function_exists( 'is_plugin_active' ) ) 
  170. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  171.  
  172. $all_plugins = get_plugins(); 
  173.  
  174. /** Save data for settings page */ 
  175. if ( isset( $_REQUEST['gglplsn_form_submit'] ) && check_admin_referer( $plugin_basename, 'gglplsn_nonce_name' ) ) { 
  176. if ( isset( $_POST['bws_hide_premium_options'] ) ) { 
  177. $hide_result = bws_hide_premium_options( $gglplsn_options ); 
  178. $gglplsn_options = $hide_result['options']; 
  179.  
  180. $gglplsn_options['plus_one_js'] = isset( $_REQUEST['gglplsn_plus_one_js'] ) ? 1 : 0; 
  181. $gglplsn_options['plus_one_annotation'] = esc_html( $_REQUEST['gglplsn_plus_one_annotation'] ); 
  182. $gglplsn_options['plus_one_size'] = esc_html( $_REQUEST['gglplsn_plus_one_size'] ); 
  183. $gglplsn_options['plus_one_annotation_type'] = esc_html( $_REQUEST['gglplsn_plus_one_annotation_type'] ); 
  184. $gglplsn_options['share_js'] = isset( $_REQUEST['gglplsn_share_js'] ) ? 1 : 0; 
  185. $gglplsn_options['share_size'] = intval( $_REQUEST['gglplsn_share_size'] ); 
  186. $gglplsn_options['share_annotation_type'] = esc_html( $_REQUEST['gglplsn_share_annotation_type'] ); 
  187. $gglplsn_options['share_annotation'] = esc_html( $_REQUEST['gglplsn_share_annotation'] ); 
  188. $gglplsn_options['follow_js'] = isset( $_REQUEST['gglplsn_follow_js'] ) ? 1 : 0; 
  189. $gglplsn_options['follow_annotation'] = esc_html( $_REQUEST['gglplsn_follow_annotation'] ); 
  190. $gglplsn_options['follow_size'] = intval( $_REQUEST['gglplsn_follow_size'] ); 
  191. $gglplsn_options['follow_id'] = esc_html( $_REQUEST['gglplsn_follow_id'] ); 
  192. $gglplsn_options['follow_relationship'] = esc_html( $_REQUEST['gglplsn_follow_relationship'] ); 
  193. $gglplsn_options['hangout_js'] = isset( $_REQUEST['gglplsn_hangout_js'] ) ? 1 : 0; 
  194. $gglplsn_options['hangout_topic'] = esc_html( $_REQUEST['gglplsn_hangout_topic'] ); 
  195. $gglplsn_options['hangout_topic_title'] = esc_html( $_REQUEST['gglplsn_hangout_topic_title'] ); 
  196. $gglplsn_options['hangout_size'] = esc_html( $_REQUEST['gglplsn_hangout_size'] ); 
  197. $gglplsn_options['hangout_type'] = esc_html( $_REQUEST['gglplsn_hangout_type'] ); 
  198. $gglplsn_options['hangout_invite_type'] = array(); 
  199. $gglplsn_options['hangout_invite_id'] = array(); 
  200. $gglplsn_options['badge_js'] = isset( $_REQUEST['gglplsn_badge_js'] ) ? 1 : 0; 
  201. $gglplsn_options['badge_type'] = esc_html( $_REQUEST['gglplsn_badge_type'] ); 
  202. $gglplsn_options['badge_id'] = esc_html( $_REQUEST['gglplsn_badge_id'] ); 
  203. $gglplsn_options['badge_layout'] = ( 'portrait' == $_REQUEST['gglplsn_badge_layout'] ) ? 'portrait' : 'landscape'; 
  204. $gglplsn_options['badge_show_cover'] = isset( $_REQUEST['gglplsn_badge_show_cover'] ) ? true : false; 
  205. $gglplsn_options['badge_show_tagline'] = isset( $_REQUEST['gglplsn_badge_show_tagline'] ) ? true : false; 
  206. $gglplsn_options['badge_show_owners'] = isset( $_REQUEST['gglplsn_badge_show_owners'] ) ? true : false; 
  207. $gglplsn_options['badge_theme'] = esc_html( $_REQUEST['gglplsn_badge_theme'] ); 
  208. $gglplsn_options['badge_width'] = intval( $_REQUEST['gglplsn_badge_width'] ); 
  209. $gglplsn_options['position'] = esc_html( $_REQUEST['gglplsn_position'] ); 
  210. $gglplsn_options['lang'] = esc_html( $_REQUEST['gglplsn_lang'] ); 
  211. $gglplsn_options['posts'] = isset( $_REQUEST['gglplsn_posts'] ) ? 1 : 0 ; 
  212. $gglplsn_options['pages'] = isset( $_REQUEST['gglplsn_pages'] ) ? 1 : 0 ; 
  213. $gglplsn_options['homepage'] = isset( $_REQUEST['gglplsn_homepage'] ) ? 1 : 0 ; 
  214. $gglplsn_options['use_multilanguage_locale'] = isset( $_REQUEST['gglplsn_use_multilanguage_locale'] ) ? 1 : 0; 
  215.  
  216. if ( $gglplsn_options['badge_width'] < 180 && 'portrait' == $gglplsn_options['badge_layout'] ) { 
  217. $gglplsn_options['badge_width'] = 180; 
  218. } elseif ( $gglplsn_options['badge_width'] < 273 && 'landscape' == $gglplsn_options['badge_layout'] ) { 
  219. $gglplsn_options['badge_width'] = 273; 
  220. } elseif ( $gglplsn_options['badge_width'] > 450 ) { 
  221. $gglplsn_options['badge_width'] = 450; 
  222.  
  223. $count = 0; 
  224. /** Save invites if Java Script is enabled */ 
  225. if ( ! isset( $_REQUEST['gglplsn_hangout_invite_type_hidden_noscript'] ) && ! isset( $_REQUEST['gglplsn_hangout_invite_del_noscript'] ) && ! isset( $_REQUEST['gglplsn_hangout_invite_add_noscript'] ) && isset( $_REQUEST['gglplsn_hangout_invite_type_hidden'] ) ) { 
  226. foreach( $_REQUEST['gglplsn_hangout_invite_type_hidden'] as $value ) { 
  227. $gglplsn_options['hangout_invite_type'][ $count ] = $value; 
  228. $gglplsn_options['hangout_invite_id'][ $count ] = sanitize_text_field( $_REQUEST['gglplsn_hangout_invite_id_hidden'][ $count ] ); 
  229. $count ++; 
  230. /** Delete selected invites if Java Script is disabled */ 
  231. } elseif ( isset( $_REQUEST['gglplsn_hangout_invite_del_noscript'] ) && isset( $_REQUEST['gglplsn_hangout_invite_type_hidden_noscript'] ) ) { 
  232. $save_count = 0; 
  233. foreach( $_REQUEST['gglplsn_hangout_invite_type_hidden_noscript'] as $value ) { 
  234. if ( ! isset( $_REQUEST['gglplsn_hangout_invite_checkbox'][ $count ] ) ) { 
  235. $gglplsn_options['hangout_invite_type'][ $save_count ] = $value; 
  236. $gglplsn_options['hangout_invite_id'][ $save_count ] = $_REQUEST['gglplsn_hangout_invite_id_hidden_noscript'][ $count ]; 
  237. $save_count ++; 
  238. $count ++; 
  239. /** Save added invites if Java Script is disabled */ 
  240. } elseif ( isset( $_REQUEST['gglplsn_hangout_invite_type_hidden_noscript'] ) ) { 
  241. foreach( $_REQUEST['gglplsn_hangout_invite_type_hidden_noscript'] as $value ) { 
  242. $gglplsn_options['hangout_invite_type'][ $count ] = $value; 
  243. $gglplsn_options['hangout_invite_id'][ $count ] = $_REQUEST['gglplsn_hangout_invite_id_hidden_noscript'][ $count ]; 
  244. $count ++; 
  245.  
  246. if ( isset( $_REQUEST['gglplsn_hangout_invite_add_noscript'] ) ) { 
  247. /** Invite Email validating if Java Script is disabled */ 
  248. if ( ! empty( $_REQUEST['gglplsn_hangout_invite_id_noscript'] ) && isset( $_REQUEST['gglplsn_hangout_invite_type_select'] ) ) { 
  249. $noscript_validate_email = true; 
  250. if ( 'EMAIL' == $_REQUEST['gglplsn_hangout_invite_type_select'] ) { 
  251. $noscript_validate_email = is_email( $_REQUEST['gglplsn_hangout_invite_id_noscript'] ); 
  252.  
  253. /** Invite errors for disabled Java Script */ 
  254. if ( isset( $noscript_validate_email ) && false == $noscript_validate_email ) { 
  255. $error = __( 'Email is invalid', 'google-one' ); 
  256. } elseif ( empty( $_REQUEST['gglplsn_hangout_invite_type_select'] ) ) { 
  257. $error = __( 'Please, select the invitation type', 'google-one' ); 
  258. } elseif ( empty( $_REQUEST['gglplsn_hangout_invite_id_noscript'] ) ) { 
  259. $error = __( "Invitation field can't be empty", 'google-one' ); 
  260.  
  261. if ( ! empty( $gglplsn_options['hangout_invite_type'] ) && '' == $error ) { 
  262. $phone_added = array_search( 'PHONE', $gglplsn_options['hangout_invite_type'] ); 
  263. if ( false !== $phone_added && 'PHONE' == $_REQUEST['gglplsn_hangout_invite_type_select'] ) { 
  264. $error = __( 'Only one phone number can be added', 'google-one' ); 
  265. } elseif ( false !== $phone_added && 'PHONE' != $_REQUEST['gglplsn_hangout_invite_type_select'] ) { 
  266. $error = __( "You can't add the invitation because the phone number is already added", 'google-one' ); 
  267. } elseif ( false === $phone_added && 'PHONE' == $_REQUEST['gglplsn_hangout_invite_type_select'] ) { 
  268. $error = __( "You can't add the phone number because another invitation type is already added", 'google-one' ); 
  269.  
  270. foreach( $gglplsn_options['hangout_invite_id'] as $value ) { 
  271. if ( $_REQUEST['gglplsn_hangout_invite_id_noscript'] == $value ) { 
  272. $error = __( 'Is already added', 'google-one' ); 
  273. break; 
  274.  
  275. /** Add invite if Java Script is disabled */ 
  276. if ( '' == $error ) { 
  277. $gglplsn_options['hangout_invite_type'][ $count ] = $_REQUEST['gglplsn_hangout_invite_type_select']; 
  278. $gglplsn_options['hangout_invite_id'][ $count ] = sanitize_text_field( $_REQUEST['gglplsn_hangout_invite_id_noscript'] ); 
  279.  
  280. $message = __( 'Settings saved', 'google-one' ); 
  281. update_option( 'gglplsn_options', $gglplsn_options ); 
  282.  
  283. /**## check banner */ 
  284. $bws_hide_premium_options_check = bws_hide_premium_options_check( $gglplsn_options ); 
  285.  
  286. /** Add restore function */ 
  287. if ( isset( $_REQUEST['bws_restore_confirm'] ) && check_admin_referer( $plugin_basename, 'bws_settings_nonce_name' ) ) { 
  288. $gglplsn_options = $gglplsn_option_defaults; 
  289. update_option( 'gglplsn_options', $gglplsn_options ); 
  290. $message = __( 'All plugin settings were restored.', 'google-one' ); 
  291.  
  292. /**pls GO PRO */ 
  293. if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) { 
  294. $go_pro_result = bws_go_pro_tab_check( $plugin_basename, 'gglplsn_options' ); 
  295. if ( ! empty( $go_pro_result['error'] ) ) 
  296. $error = $go_pro_result['error']; 
  297. elseif ( ! empty( $go_pro_result['message'] ) ) 
  298. $message = $go_pro_result['message']; 
  299. } /** end GO PRO pls*/##*/ ?> 
  300. <!-- general --> 
  301. <div class="wrap"> 
  302. <h1><?php _e( 'Google +1 Settings', 'google-one' ); ?></h1> 
  303. <ul class="subsubsub gglplsn_how_to_use"> 
  304. <li><a href="https://docs.google.com/document/d/1v7j8TysjjBzXVnqozmfxMgjg5f7PS6XtV1GmZxnlNDk" target="_blank"><?php _e( 'How to Use Step-by-step Instruction', 'google-one' ); ?></a></li> 
  305. </ul> 
  306. <h2 class="nav-tab-wrapper"> 
  307. <a class="nav-tab<?php if ( ! isset( $_GET['action'] ) || ( isset( $_GET['action'] ) && ! in_array( $_GET['action'], array( 'extra', 'custom_code', 'go_pro' ) ) ) ) echo ' nav-tab-active'; ?>" href="admin.php?page=google-plus-one.php"><?php _e( 'Settings', 'google-one' ); ?></a> 
  308. <!-- pls --> 
  309. <a class="nav-tab<?php if ( isset( $_GET['action'] ) && 'extra' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=google-plus-one.php&action=extra"><?php _e( 'Extra settings', 'google-one' ); ?></a> 
  310. <!-- end pls --> 
  311. <a class="nav-tab<?php if ( isset( $_GET['action'] ) && 'custom_code' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=google-plus-one.php&action=custom_code"><?php _e( 'Custom Code', 'google-one' ); ?></a> 
  312. <!-- pls --> 
  313. <a class="nav-tab bws_go_pro_tab<?php if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=google-plus-one.php&action=go_pro"><?php _e( 'Go PRO', 'google-one' ); ?></a> 
  314. <!-- end pls --> 
  315. </h2> 
  316. <noscript><div class="error below-h2"><p><strong><?php _e( 'Please, enable JavaScript in Your browser.', 'google-one' ); ?></strong></p></div></noscript> 
  317. <?php if ( ! empty( $hide_result['message'] ) ) { ?> 
  318. <div class="updated fade below-h2"><p><strong><?php echo $hide_result['message']; ?></strong></p></div> 
  319. <?php } ?> 
  320. <!-- end general --> 
  321. <div class="updated fade below-h2" <?php if ( '' == $message || "" != $error ) echo 'style="display:none"'; ?>><p><strong><?php echo $message; ?></strong></p></div> 
  322. <?php bws_show_settings_notice(); ?> 
  323. <div class="error below-h2" <?php if ( "" == $error ) echo 'style="display:none"'; ?>><p><strong><?php echo $error; ?></strong></p></div> 
  324. <?php /**## check action */ if ( ! isset( $_GET['action'] ) || ( isset( $_GET['action'] ) && ! in_array( $_GET['action'], array( 'extra', 'custom_code', 'go_pro' ) ) ) ) { 
  325. if ( isset( $_REQUEST['bws_restore_default'] ) && check_admin_referer( $plugin_basename, 'bws_settings_nonce_name' ) ) { 
  326. bws_form_restore_default_confirm( $plugin_basename ); 
  327. } else { /** check action ##*/ ?> 
  328. <div id="gglplsn_settings_form_block"> 
  329. <p><?php _e( 'For the correct work of the button do not use it locally or on a free hosting', 'google-one' ); ?><br /></p> 
  330. <div><?php printf( 
  331. __( "If you'd like to add Google Buttons to your page or post, please use %s button", 'google-one' ),  
  332. '<span class="bws_code"><span class="bwsicons bwsicons-shortcode"></span></span>' ); ?> 
  333. <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help"> 
  334. <div class="bws_hidden_help_text" style="min-width:180px;"> 
  335. <?php printf( 
  336. __( "You can add Google Buttons to your page or post by clicking on %s button in the content edit block using the Visual mode. If the button isn't displayed, please use the shortcode %s to show the Google +1 Button, or use parameter 'display', e.g. %s to display these buttons", 'google-one' ),  
  337. '<span class="bws_code"><span class="bwsicons bwsicons-shortcode"></span></span>',  
  338. '[bws_googleplusone]',  
  339. '<br>[bws_googleplusone display="plusone, share, follow, hangout, badge"]' 
  340. ); ?> 
  341. </div> 
  342. </div> 
  343. </div> 
  344. <div class="gglplsn-form"> 
  345. <form method="post" action="" class="bws_form"> 
  346. <table class="form-table gglplsn_form-table"> 
  347. <tbody> 
  348. <tr valign="top"> 
  349. <th><?php _e( 'Display Google Buttons', 'google-one' ); ?></th> 
  350. <td> 
  351. <fieldset> 
  352. <label> 
  353. <input type="checkbox" name="gglplsn_plus_one_js"<?php if ( 1 == $gglplsn_options['plus_one_js'] ) echo 'checked="checked"'; ?> value="1" /> 
  354. <?php _e( 'Google +1', 'google-one' ); ?> 
  355. </label> 
  356. <br /> 
  357. <label> 
  358. <input type="checkbox" name="gglplsn_share_js"<?php if ( 1 == $gglplsn_options['share_js'] ) echo 'checked="checked"'; ?> value="1" /> 
  359. <?php _e( 'Share', 'google-one' ); ?> 
  360. </label> 
  361. <br /> 
  362. <label> 
  363. <input type="checkbox" name="gglplsn_follow_js"<?php if ( 1 == $gglplsn_options['follow_js'] ) echo 'checked="checked"'; ?> value="1" /> 
  364. <?php _e( 'Follow', 'google-one' ); ?> 
  365. </label> 
  366. <span class="bws_info gglplsn_notice gglplsn-follow-notice gglplsn-unvisible-notice"> 
  367. <?php if ( empty( $gglplsn_options['follow_id'] ) ) { ?> 
  368. (<?php _e( 'To see this button, please', 'google-one' ); ?> 
  369. <a class="gglplsn-follow-focus"><?php _e( 'enter', 'google-one' ) ?></a> 
  370. <?php _e( 'the Google+ ID', 'google-one' ); ?>) 
  371. <?php } ?> 
  372. </span> 
  373. <br /> 
  374. <label> 
  375. <input type="checkbox" name="gglplsn_hangout_js"<?php if ( 1 == $gglplsn_options['hangout_js'] ) echo 'checked="checked"'; ?> value="1" /> 
  376. <?php _e( 'Hangout', 'google-one' ); ?> 
  377. </label> 
  378. <br /> 
  379. <label> 
  380. <input type="checkbox" name="gglplsn_badge_js"<?php if ( 1 == $gglplsn_options['badge_js'] ) echo 'checked="checked"'; ?> value="1" /> 
  381. <?php _e( 'Badge', 'google-one' ); ?> 
  382. </label> 
  383. <span class="bws_info gglplsn_notice gglplsn-badge-notice gglplsn-unvisible-notice"> 
  384. <?php if ( empty( $gglplsn_options['badge_id'] ) ) { ?> 
  385. (<?php _e( 'To see this button, please', 'google-one' ); ?> 
  386. <a class="gglplsn-badge-focus"><?php _e( 'enter', 'google-one' ) ?></a> 
  387. <?php _e( 'the Google+ ID', 'google-one' ); ?>) 
  388. <?php } ?> 
  389. </span> 
  390. </fieldset> 
  391. </td> 
  392. </tr> 
  393. <tr> 
  394. <th scope="row"><?php _e( 'Language', 'google-one' ); ?></th> 
  395. <td> 
  396. <fieldset> 
  397. <select name="gglplsn_lang"> 
  398. <?php foreach ( $gglplsn_lang_codes as $key => $val ) { 
  399. echo '<option value="' . $key . '"'; 
  400. if ( $key == $gglplsn_options['lang'] ) { 
  401. echo ' selected="selected"'; 
  402. echo '>' . esc_html ( $val ) . '</option>'; 
  403. } ?> 
  404. </select> 
  405. <span class="bws_info">(<?php _e( 'Select the language to display information on the button', 'google-one' ); ?>)</span> 
  406. <br /> 
  407. <label> 
  408. <?php if ( array_key_exists( 'multilanguage/multilanguage.php', $all_plugins ) || array_key_exists( 'multilanguage-pro/multilanguage-pro.php', $all_plugins ) ) { 
  409. if ( is_plugin_active( 'multilanguage/multilanguage.php' ) || is_plugin_active( 'multilanguage-pro/multilanguage-pro.php' ) ) { ?> 
  410. <input type="checkbox" name="gglplsn_use_multilanguage_locale" value="1" <?php if ( 1 == $gglplsn_options["use_multilanguage_locale"] ) echo 'checked="checked"'; ?> /> 
  411. <?php _e( 'Use the current site language', 'google-one' ); ?><span class="bws_info">(<?php _e( 'Using', 'google-one' ); ?> Multilanguage by BestWebSoft)</span> 
  412. <?php } else { ?> 
  413. <input disabled="disabled" type="checkbox" name="gglplsn_use_multilanguage_locale" value="1" /> 
  414. <?php _e( 'Use the current site language', 'google-one' ); ?> 
  415. <span class="bws_info">(<?php _e( 'Using', 'google-one' ); ?> Multilanguage by BestWebSoft) 
  416. <a href="<?php echo bloginfo( "url" ); ?>/wp-admin/plugins.php"><?php _e( 'Activate', 'google-one' ); ?> Multilanguage</a> 
  417. </span> 
  418. <?php } 
  419. } else { ?> 
  420. <input disabled="disabled" type="checkbox" name="gglplsn_use_multilanguage_locale" value="1" /> 
  421. <?php _e( 'Use the current site language', 'google-one' ); ?> 
  422. <span class="bws_info">(<?php _e( 'Using', 'google-one' ); ?> Multilanguage by BestWebSoft) 
  423. <a href="http://bestwebsoft.com/products/wordpress/plugins/multilanguage/?k=4f26802e271bc07146a382140164abc1&pn=102&v=<?php echo $gglplsn_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>"><?php _e( 'Download', 'google-one' ); ?> Multilanguage</a> 
  424. </span> 
  425. <?php } ?> 
  426. </label> 
  427. </fieldset> 
  428. </td> 
  429. </tr> 
  430. <tr> 
  431. <th scope="row"><?php _e( 'Buttons Position', 'google-one' ); ?></th> 
  432. <td> 
  433. <select name="gglplsn_position"> 
  434. <option value="before_post" <?php if ( 'before_post' == $gglplsn_options['position'] ) echo 'selected="selected"'; ?>><?php _e( 'Before', 'google-one' ); ?></option> 
  435. <option value="after_post" <?php if ( 'after_post' == $gglplsn_options['position'] ) echo 'selected="selected"'; ?>><?php _e( 'After', 'google-one' ); ?></option> 
  436. <option value="afterandbefore" <?php if ( 'afterandbefore' == $gglplsn_options['position'] ) echo 'selected="selected"'; ?>><?php _e( 'Before And After', 'google-one' ); ?></option> 
  437. <option value="only_shortcode" <?php if ( 'only_shortcode' == $gglplsn_options['position'] ) echo 'selected="selected"'; ?>><?php _e( 'Only Shortcode', 'google-one' ); ?></option> 
  438. </select> 
  439. <span class="bws_info">(<?php _e( 'Please select location for the buttons on the page', 'google-one' ); ?>)</span> 
  440. </td> 
  441. </tr> 
  442. <tr> 
  443. <th scope="row"><?php _e( 'Show buttons', 'google-one' ); ?></th> 
  444. <td> 
  445. <p> 
  446. <label> 
  447. <input type="checkbox" name="gglplsn_posts" <?php if ( ! empty( $gglplsn_options['posts'] ) ) echo 'checked="checked"'; ?> value="1" /> 
  448. <?php _e( 'Show in posts', 'google-one' ); ?> 
  449. </label> 
  450. </p> 
  451. <p> 
  452. <label> 
  453. <input type="checkbox" name="gglplsn_pages" <?php if ( ! empty( $gglplsn_options['pages'] ) ) echo 'checked="checked"'; ?> value="1" /> 
  454. <?php _e( 'Show in pages', 'google-one' ); ?> 
  455. </label> 
  456. </p> 
  457. <p> 
  458. <label> 
  459. <input type="checkbox" name="gglplsn_homepage" <?php if ( ! empty( $gglplsn_options['homepage'] ) ) echo 'checked="checked"'; ?> value="1" /> 
  460. <?php _e( 'Show on the homepage', 'google-one' ); ?> 
  461. </label> 
  462. </p> 
  463. <p> 
  464. <span class="bws_info">(<?php _e( 'Please select the page on which you want to see the buttons', 'google-one' ); ?>)</span> 
  465. </p> 
  466. </td> 
  467. </tr> 
  468. <tr class="gglplsn-plus-one-options gglplsn-first <?php if ( 0 == $gglplsn_options['plus_one_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  469. <th colspan="2"><?php _e( 'Settings for Google +1 Button', 'google-one' ); ?></th> 
  470. </tr> 
  471. </tbody> 
  472. </table> 
  473. <!-- general --> 
  474. <?php if ( ! $bws_hide_premium_options_check ) { ?> 
  475. <div class="gglplsn-plus-one-options <?php if ( 0 == $gglplsn_options['plus_one_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  476. <div class="bws_pro_version_bloc"> 
  477. <div class="bws_pro_version_table_bloc"> 
  478. <button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php _e( 'Close', 'google-one' ); ?>"></button> 
  479. <div class="bws_table_bg"></div> 
  480. <table class="form-table bws_pro_version"> 
  481. <tr valign="top"> 
  482. <th><?php _e( '"+1" for an entire site on every page', 'google-one' ); ?></th> 
  483. <td> 
  484. <input disabled="disabled" name='gglplsn_entire_site_like' type='checkbox' value='1' /><br /> 
  485. <span class="bws_info"><?php _e( 'Notice: This option does not create an extra button. This option merely allows your users to +1 the entire website when this option is enabled, or a single post when this option is disabled, when clicking the regular "+1" button.', 'google-one' ); ?></span> 
  486. </td> 
  487. </tr> 
  488. <tr valign="top"> 
  489. <th scope="row" colspan="2"> 
  490. * <?php _e( 'If you upgrade to Pro version all your settings will be saved.', 'google-one' ); ?> 
  491. </th> 
  492. </tr> 
  493. </table> 
  494. </div> 
  495. <div class="bws_pro_version_tooltip"> 
  496. <a class="bws_button" href="http://bestwebsoft.com/products/wordpress/plugins/google-plus-one/?k=0a5a8a70ed3c34b95587de0604ca9517&pn=102&v=<?php echo $gglplsn_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="Google +1 Pro"><?php _e( 'Learn More', 'google-one' ); ?></a> 
  497. <div class="clear"></div> 
  498. </div> 
  499. </div> 
  500. </div> 
  501. <?php } ?> 
  502. <!-- end general --> 
  503. <table class="form-table gglplsn_form-table"> 
  504. <tbody> 
  505. <tr class="gglplsn-plus-one-options <?php if ( 0 == $gglplsn_options['plus_one_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  506. <th scope="row"><?php _e( 'Size', 'google-one' ); ?></th> 
  507. <td> 
  508. <select name="gglplsn_plus_one_size"> 
  509. <option value="standard" <?php if ( 'standard' == $gglplsn_options['plus_one_size'] ) echo 'selected="selected"'; ?>><?php _ex( 'Standard', 'for:size', 'google-one' ); ?></option> 
  510. <option value="small" <?php if ( 'small' == $gglplsn_options['plus_one_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Small', 'google-one' ); ?></option> 
  511. <option value="medium" <?php if ( 'medium' == $gglplsn_options['plus_one_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Medium', 'google-one' ); ?></option> 
  512. <option value="tall" <?php if ( 'tall' == $gglplsn_options['plus_one_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Tall', 'google-one' ); ?></option> 
  513. </select> 
  514. </td> 
  515. </tr> 
  516. <tr class="gglplsn-plus-one-options <?php if ( 0 == $gglplsn_options['plus_one_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  517. <th><?php _e( 'Annotation', 'google-one' ); ?></th> 
  518. <td> 
  519. <select name="gglplsn_plus_one_annotation"> 
  520. <option value="inline" <?php if ( 'inline' == $gglplsn_options['plus_one_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Inline', 'google-one' ); ?></option> 
  521. <option value="bubble" <?php if ( 'bubble' == $gglplsn_options['plus_one_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Bubble', 'google-one' ); ?></option> 
  522. <option value="none" <?php if ( 'none' == $gglplsn_options['plus_one_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'None', 'google-one' ); ?></option> 
  523. </select> 
  524. <br /> 
  525. <span class="bws_info">(<?php _e( 'Display counters showing how many times your article has been liked', 'google-one' ); ?>)</span> 
  526. </td> 
  527. </tr> 
  528. <tr class="gglplsn-plus-one-annotation-type <?php if ( 0 == $gglplsn_options['plus_one_js'] || 'inline' != $gglplsn_options['plus_one_annotation'] ) echo 'gglplsn-hide-option'; ?>"> 
  529. <th scope="row"><?php _e( 'Annotation Type', 'google-one' ); ?></th> 
  530. <td> 
  531. <select name="gglplsn_plus_one_annotation_type"> 
  532. <option value="standard" <?php if ( 'standard' == $gglplsn_options['plus_one_annotation_type'] ) echo 'selected="selected"';?>><?php _ex( 'Standard', 'for:annotation type', 'google-one' ) ?></option> 
  533. <option value="short" <?php if ( 'short' == $gglplsn_options['plus_one_annotation_type'] ) echo 'selected="selected"';?>><?php _e( 'Short', 'google-one' ) ?></option> 
  534. </select> 
  535. </td> 
  536. </tr> 
  537. <tr class="gglplsn-share-options gglplsn-first <?php if ( 0 == $gglplsn_options['share_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  538. <th colspan="2"><?php _e( 'Settings for Share Button', 'google-one' ); ?></th> 
  539. </tr> 
  540. <tr class="gglplsn-share-options <?php if ( 0 == $gglplsn_options['share_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  541. <th><?php _e( 'Annotation', 'google-one' ); ?></th> 
  542. <td> 
  543. <select name="gglplsn_share_annotation"> 
  544. <option value="inline" <?php if ( 'inline' == $gglplsn_options['share_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Inline', 'google-one' ); ?></option> 
  545. <option value="bubble" <?php if ( 'bubble' == $gglplsn_options['share_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Bubble', 'google-one' ); ?></option> 
  546. <option value="vertical-bubble" <?php if ( 'vertical-bubble' == $gglplsn_options['share_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Vertical-bubble', 'google-one' ); ?></option> 
  547. <option value="none" <?php if ( 'none' == $gglplsn_options['share_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'None', 'google-one' ); ?></option> 
  548. </select> 
  549. <p> 
  550. <span class="bws_info">(<?php _e( 'Display the number of users who have shared the page', 'google-one' ); ?>)</span> 
  551. </p> 
  552. </td> 
  553. </tr> 
  554. <tr class="gglplsn-share-size <?php if ( 0 == $gglplsn_options['share_js'] || 'vertical-bubble' == $gglplsn_options['share_annotation'] ) echo 'gglplsn-hide-option'; ?>"> 
  555. <th scope="row"><?php _e( 'Size', 'google-one' ); ?></th> 
  556. <td> 
  557. <select name="gglplsn_share_size"> 
  558. <option value="15" <?php if ( 15 == $gglplsn_options['share_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Small', 'google-one' ); ?></option> 
  559. <option value="20" <?php if ( 20 == $gglplsn_options['share_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Medium', 'google-one' ); ?></option> 
  560. <option value="24" <?php if ( 24 == $gglplsn_options['share_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Large', 'google-one' ); ?></option> 
  561. </select> 
  562. </td> 
  563. </tr> 
  564. <tr class="gglplsn-share-annotation-type <?php if ( 0 == $gglplsn_options['share_js'] || 'inline' != $gglplsn_options['share_annotation'] ) echo 'gglplsn-hide-option'; ?>"> 
  565. <th scope="row"><?php _e( 'Annotation Type', 'google-one' ); ?></th> 
  566. <td> 
  567. <select name="gglplsn_share_annotation_type"> 
  568. <option value="standard" <?php if ( 'standard' == $gglplsn_options['share_annotation_type'] ) echo 'selected="selected"';?>><?php echo _ex( 'Standard', 'for:annotation type', 'google-one' ) ?></option> 
  569. <option value="short" <?php if ( 'short' == $gglplsn_options['share_annotation_type'] ) echo 'selected="selected"';?>><?php _e( 'Short', 'google-one' ) ?></option> 
  570. </select> 
  571. </td> 
  572. </tr> 
  573. <tr class="gglplsn-follow-options gglplsn-first <?php if ( 0 == $gglplsn_options['follow_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  574. <th colspan="2"><?php _e( 'Settings for Follow Button', 'google-one' ); ?></th> 
  575. </tr> 
  576. <tr class="gglplsn-follow-options <?php if ( 0 == $gglplsn_options['follow_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  577. <th><?php _e( 'Google+ ID', 'google-one' ); ?></th> 
  578. <td> 
  579. <input type="text" <?php if ( 1 == $gglplsn_options['follow_js'] ) { echo 'required="required"'; } ?> name="gglplsn_follow_id" value="<?php echo $gglplsn_options['follow_id']; ?>" /> 
  580. <p> 
  581. <span class="bws_info">(<?php echo __( 'Enter the Google+ ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one') . ' "+YouName"'; ?>)</span> 
  582. </p> 
  583. </td> 
  584. </tr> 
  585. <tr class="gglplsn-follow-options <?php if ( 0 == $gglplsn_options['follow_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  586. <th><?php _e( 'Relationship', 'google-one' ); ?></th> 
  587. <td> 
  588. <select name="gglplsn_follow_relationship"> 
  589. <option value="author" <?php if ( 'author' == $gglplsn_options['follow_relationship'] ) echo 'selected="selected"'; ?>><?php _e( 'Author', 'google-one' ); ?></option> 
  590. <option value="publisher" <?php if ( 'publisher' == $gglplsn_options['follow_relationship'] ) echo 'selected="selected"'; ?>><?php _e( 'Publisher', 'google-one' ); ?></option> 
  591. </select> 
  592. <p> 
  593. <span class="bws_info">(<?php _e( 'Describes your relationship to content of the page, where the button is embedded', 'google-one' ); ?>)</span> 
  594. </p> 
  595. </td> 
  596. </tr> 
  597. <tr class="gglplsn-follow-options <?php if ( 0 == $gglplsn_options['follow_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  598. <th scope="row"><?php _e( 'Size', 'google-one' ); ?></th> 
  599. <td> 
  600. <select name="gglplsn_follow_size"> 
  601. <option value="15" <?php if ( 15 == $gglplsn_options['follow_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Small', 'google-one' ); ?></option> 
  602. <option value="20" <?php if ( 20 == $gglplsn_options['follow_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Medium', 'google-one' ); ?></option> 
  603. <option value="24" <?php if ( 24 == $gglplsn_options['follow_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Large', 'google-one' ); ?></option> 
  604. </select> 
  605. </td> 
  606. </tr> 
  607. <tr class="gglplsn-follow-options <?php if ( 0 == $gglplsn_options['follow_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  608. <th><?php _e( 'Annotation', 'google-one' ); ?></th> 
  609. <td> 
  610. <select name="gglplsn_follow_annotation"> 
  611. <option value="bubble" <?php if ( 'bubble' == $gglplsn_options['follow_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Bubble', 'google-one' ); ?></option> 
  612. <option value="vertical-bubble" <?php if ( 'vertical-bubble' == $gglplsn_options['follow_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'Vertical-bubble', 'google-one' ); ?></option> 
  613. <option value="none" <?php if ( 'none' == $gglplsn_options['follow_annotation'] ) echo 'selected="selected"'; ?>><?php _e( 'None', 'google-one' ); ?></option> 
  614. </select> 
  615. <p> 
  616. <span class="bws_info">(<?php _e( 'Display the number of users who are following this page or person', 'google-one' ); ?>)</span> 
  617. </p> 
  618. </td> 
  619. </tr> 
  620. <tr class="gglplsn-hangout-options gglplsn-first <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  621. <th colspan="2"><?php _e( 'Settings for Hangout Button', 'google-one' ); ?></th> 
  622. </tr> 
  623. <tr class="gglplsn-hangout-options <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  624. <th><?php _e( 'Topic', 'google-one' ); ?></th> 
  625. <td> 
  626. <label class="gglplsn-hangout-topic"> 
  627. <input type="radio" name="gglplsn_hangout_topic_title" value="1" <?php if ( 1 == $gglplsn_options['hangout_topic_title'] ) echo 'checked="checked"'; ?> /> 
  628. <?php _e( 'Use the title of the page', 'google-one' ); ?> 
  629. </label> 
  630. <br /> 
  631. <label class="gglplsn-hangout-topic"> 
  632. <input type="radio" name="gglplsn_hangout_topic_title" value="0" class="gglplsn-hangout-topic-radio" <?php if ( 1 != $gglplsn_options['hangout_topic_title'] ) echo 'checked="checked"'; ?> /> 
  633. <input type="text" name="gglplsn_hangout_topic" class="gglplsn-hangout-topic-text" value="<?php echo $gglplsn_options['hangout_topic']; ?>" /> 
  634. </label> 
  635. </td> 
  636. </tr> 
  637. <tr class="gglplsn-hangout-options <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  638. <th><?php _e( 'Size', 'google-one' ); ?></th> 
  639. <td> 
  640. <select name="gglplsn_hangout_size"> 
  641. <option value="standard" <?php if ( 'standard' == $gglplsn_options['hangout_size'] ) echo 'selected="selected"'; ?>><?php _ex( 'Standard', 'for:size', 'google-one' ); ?></option> 
  642. <option value="narrow" <?php if ( 'narrow' == $gglplsn_options['hangout_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Narrow', 'google-one' ); ?></option> 
  643. <option value="wide" <?php if ( 'wide' == $gglplsn_options['hangout_size'] ) echo 'selected="selected"'; ?>><?php _e( 'Wide', 'google-one' ); ?></option> 
  644. </select> 
  645. </td> 
  646. </tr> 
  647. <tr class="gglplsn-hangout-options <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  648. <th><?php _e( 'Type', 'google-one' ); ?></th> 
  649. <td> 
  650. <select name="gglplsn_hangout_type"> 
  651. <option value="normal" <?php if ( 'normal' == $gglplsn_options['hangout_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Normal', 'google-one' ); ?></option> 
  652. <option value="onair" <?php if ( 'onair' == $gglplsn_options['hangout_type'] ) echo 'selected="selected"'; ?>><?php _e( 'On air', 'google-one' ); ?></option> 
  653. <option value="party" <?php if ( 'party' == $gglplsn_options['hangout_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Party', 'google-one' ); ?></option> 
  654. <option value="moderated" <?php if ( 'moderated' == $gglplsn_options['hangout_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Moderated', 'google-one' ); ?></option> 
  655. </select> 
  656. </td> 
  657. </tr> 
  658. <tr class="gglplsn-hangout-options gglplsn-hangout-invite-type <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  659. <th><?php _e( 'Invitation Type', 'google-one' ); ?></th> 
  660. <td> 
  661. <select id="gglplsn_hangout_invite_type" name="gglplsn_hangout_invite_type_select"> 
  662. <option value="" disabled="disabled" selected="selected"><?php _e( 'Select The Type', 'google-one' ); ?></option> 
  663. <option value="PROFILE"><?php _e( 'Google+ Profile ID', 'google-one' ); ?></option> 
  664. <option value="CIRCLE"><?php _e( 'Google+ Circle ID', 'google-one' ); ?></option> 
  665. <option value="EMAIL"><?php _e( 'Email', 'google-one' ); ?></option> 
  666. <option value="PHONE"><?php _e( 'Phone Number', 'google-one' ); ?></option> 
  667. </select> 
  668. <div class="tagchecklist gglplsn-view-invited" style="display:none;"> 
  669. <?php if ( ! empty( $gglplsn_options['hangout_invite_type'] ) ) { 
  670. for ( $i = 0; $i < count( $gglplsn_options['hangout_invite_type'] ); $i++ ) { ?> 
  671. <div> 
  672. <input name="gglplsn_hangout_invite_type_hidden[]" value="<?php echo $gglplsn_options['hangout_invite_type'][ $i ] ?>" type="hidden" /> 
  673. <input name="gglplsn_hangout_invite_id_hidden[]" value="<?php echo $gglplsn_options['hangout_invite_id'][ $i ] ?>" type="hidden" /> 
  674. <span> 
  675. <a class="delbutton"></a> 
  676. <?php echo ' ' . $gglplsn_options['hangout_invite_id'][ $i ] ?> 
  677. </span> 
  678. </div> 
  679. <?php } 
  680. } ?> 
  681. </div> 
  682. <noscript> 
  683. <div class="tagchecklist gglplsn-view-invited-noscript"> 
  684. <?php if ( ! empty( $gglplsn_options['hangout_invite_type'] ) ) { 
  685. for ( $i = 0; $i < count( $gglplsn_options['hangout_invite_type'] ); $i++ ) { ?> 
  686. <p> 
  687. <input name="gglplsn_hangout_invite_type_hidden_noscript[<?php echo $i; ?>]" value="<?php echo $gglplsn_options['hangout_invite_type'][ $i ]; ?>" type="hidden" /> 
  688. <input name="gglplsn_hangout_invite_id_hidden_noscript[<?php echo $i; ?>]" value="<?php echo $gglplsn_options['hangout_invite_id'][ $i ]; ?>" type="hidden" /> 
  689. <input type="checkbox" name="gglplsn_hangout_invite_checkbox[<?php echo $i; ?>]" id="gglplsn_hangout_invite_checkbox[<?php echo $i; ?>]" value="1" /> 
  690. <label for="gglplsn_hangout_invite_checkbox[<?php echo $i; ?>]"> 
  691. <?php echo $gglplsn_options['hangout_invite_id'][ $i ]; ?> 
  692. </label> 
  693. </p> 
  694. <?php } 
  695. } ?> 
  696. </div> 
  697. </noscript> 
  698. </td> 
  699. </tr> 
  700. <tr class="gglplsn-invite-tr-noscript"> 
  701. <th> 
  702. <noscript> 
  703. <?php _e( 'Google+ ID, Phone Number or Email', 'google-one' ); ?> 
  704. </noscript> 
  705. </th> 
  706. <td> 
  707. <noscript> 
  708. <input type="text" id="gglplsn_hangout_invite_id_noscript" name="gglplsn_hangout_invite_id_noscript" /> 
  709. <input type="submit" name="gglplsn_hangout_invite_add_noscript" class="button tagadd" value="<?php _e( 'Add', 'google-one' ); ?>" id="gglplsn_hangout_invite_add_noscript" /> 
  710. <?php if ( ! empty( $gglplsn_options['hangout_invite_type'] ) ) { ?> 
  711. <input type="submit" name="gglplsn_hangout_invite_del_noscript" class="button tagadd" value="<?php _e( 'Delete Selected', 'google-one' ); ?>" id="gglplsn_hangout_invite_del" /> 
  712. <?php } ?> 
  713. <p class="gglplsn-id-prompt"> 
  714. <span class="bws_info"><?php echo __( "If Invitation Type is 'Google+ Profile ID', it should look like", 'google-one' ) . ' "12345678912345678912 " ' . __( 'or', 'google-one' ) . ' "+YouName"' ?></span> 
  715. </p> 
  716. <hr class="gglplsn-noscript-hr" /> 
  717. <p class="gglplsn-id-prompt"> 
  718. <span class="bws_info"><?php echo __( "If Invitation Type is 'Google+ Circle ID', it should look like", 'google-one' ) . ' "123ab345cd576ef7"'?></span> 
  719. </p> 
  720. <hr class="gglplsn-noscript-hr" /> 
  721. <p class="gglplsn-id-prompt"> 
  722. <span class="bws_info"><?php echo __( "If Invitation Type is 'Email', it should look like", 'google-one' ) . ' "example@gmail.com"'; ?></span> 
  723. </p> 
  724. <hr class="gglplsn-noscript-hr" /> 
  725. <p class="gglplsn-id-prompt"> 
  726. <span class="bws_info"><?php echo __( "If Invitation Type is 'Phone Number', it should look like", 'google-one' ) . ' "+38001234567"'; ?></span> 
  727. </p> 
  728. </noscript> 
  729. </td> 
  730. </tr> 
  731. <tr class="gglplsn-hangout-options gglplsn-hangout-invite-id <?php if ( 0 == $gglplsn_options['hangout_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  732. <th style="display:none;"></th> 
  733. <td style="display:none;"> 
  734. <input type="text" id="gglplsn_hangout_invite_id" /> 
  735. <input type="submit" class="button tagadd" value="<?php _e( 'Add', 'google-one' ); ?>" id="gglplsn_hangout_invite_add" /> 
  736. <p class="gglplsn-id-prompt"> 
  737. <span class="bws_info"></span> 
  738. </p> 
  739. <p id='gglplsn_invite_id_error' style="display:none;"></p> 
  740. </td> 
  741. </tr> 
  742. <tr class="gglplsn-badge-options gglplsn-first <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  743. <th colspan="2"><?php _e( 'Settings for Badge', 'google-one' ); ?></th> 
  744. </tr> 
  745. <tr class="gglplsn-badge-options <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  746. <th><?php _e( 'Type', 'google-one' ); ?></th> 
  747. <td> 
  748. <select name="gglplsn_badge_type"> 
  749. <option value="person" <?php if ( 'person' == $gglplsn_options['badge_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Person', 'google-one' ); ?></option> 
  750. <option value="page" <?php if ( 'page' == $gglplsn_options['badge_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Page', 'google-one' ); ?></option> 
  751. <option value="community" <?php if ( 'community' == $gglplsn_options['badge_type'] ) echo 'selected="selected"'; ?>><?php _e( 'Community', 'google-one' ); ?></option> 
  752. </select> 
  753. </td> 
  754. </tr> 
  755. <tr class="gglplsn-badge-options <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  756. <th class="gglplsn-badge-id-th"> 
  757. <?php switch( $gglplsn_options['badge_type'] ) { 
  758. case 'person' : 
  759. $gglplsn_badge_id_th = __( 'Google+ ID', 'google-one' ); 
  760. $gglplsn_badge_id_info = __( 'Enter the Google+ ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+YouName"'; 
  761. $gglplsn_badge_tagline_info = __( "Display the user's tag line", 'google-one' ); 
  762. break; 
  763. case 'page' : 
  764. $gglplsn_badge_id_th = __( 'Google+ Page ID', 'google-one' ); 
  765. $gglplsn_badge_id_info = __( 'Enter the Google+ Page ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+CompanyName"'; 
  766. $gglplsn_badge_tagline_info = __( 'Display the company tag line', 'google-one' ); 
  767. break; 
  768. case 'community' : 
  769. $gglplsn_badge_id_th = __( 'Google+ Community ID', 'google-one' ); 
  770. $gglplsn_badge_id_info = __( 'Enter the Google+ Community ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+CommunityName"'; 
  771. $gglplsn_badge_tagline_info = __( 'Display the community tag line', 'google-one' ); 
  772. break; 
  773. echo $gglplsn_badge_id_th; ?> 
  774. </th> 
  775. <td> 
  776. <input type="text" name="gglplsn_badge_id" <?php if ( 1 == $gglplsn_options['badge_js'] ) { echo 'required="required"'; } ?> value="<?php echo $gglplsn_options['badge_id']; ?>" /> 
  777. <p> 
  778. <span class="bws_info gglplsn-badge-id-info">(<?php echo $gglplsn_badge_id_info; ?>)</span> 
  779. </p> 
  780. </td> 
  781. </tr> 
  782. <tr class="gglplsn-badge-options <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  783. <th><?php _e( 'Layout', 'google-one' ); ?></th> 
  784. <td> 
  785. <select name="gglplsn_badge_layout"> 
  786. <option value="portrait" <?php if ( 'portrait' == $gglplsn_options['badge_layout'] ) echo 'selected="selected"'; ?>><?php _e( 'Portrait', 'google-one' ); ?></option> 
  787. <option value="landscape" <?php if ( 'landscape' == $gglplsn_options['badge_layout'] ) echo 'selected="selected"'; ?>><?php _e( 'Landscape', 'google-one' ); ?></option> 
  788. </select> 
  789. <p> 
  790. <span class="bws_info">(<?php _e( 'Sets the orientation of the badge', 'google-one' ); ?>)</span> 
  791. </p> 
  792. </td> 
  793. </tr> 
  794. <tr class="gglplsn-badge-options gglplsn-show-cover <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  795. <th><?php _e( 'Show Cover Photo', 'google-one' ); ?></th> 
  796. <td> 
  797. <label> 
  798. <input type="checkbox" name="gglplsn_badge_show_cover"<?php if ( true == $gglplsn_options['badge_show_cover'] ) echo 'checked="checked"'; ?> value="1" /> 
  799. </label> 
  800. </td> 
  801. </tr> 
  802. <tr class="gglplsn-badge-options gglplsn-show-tagline <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  803. <th><?php _e( 'Show Tag Line', 'google-one' ); ?></th> 
  804. <td> 
  805. <label> 
  806. <input type="checkbox" name="gglplsn_badge_show_tagline" <?php if ( true == $gglplsn_options['badge_show_tagline'] ) echo 'checked="checked"'; ?> value="1" /> 
  807. <span class="bws_info gglplsn-badge-tagline-info">(<?php echo $gglplsn_badge_tagline_info; ?>)</span> 
  808. </label> 
  809. </td> 
  810. </tr> 
  811. <tr class="gglplsn-show-owners <?php if ( 0 == $gglplsn_options['badge_js'] || 'community' != $gglplsn_options['badge_type'] ) echo 'gglplsn-hide-option'; ?>"> 
  812. <th><?php _e( 'Show Owners', 'google-one' ); ?></th> 
  813. <td> 
  814. <label> 
  815. <input type="checkbox" name="gglplsn_badge_show_owners"<?php if ( true == $gglplsn_options['badge_show_owners'] ) echo 'checked="checked"'; ?> value="1" /> 
  816. <span class="bws_info">(<?php _e( 'Display a list of community owners', 'google-one' ); ?>)</span> 
  817. </label> 
  818. </td> 
  819. </tr> 
  820. <tr class="gglplsn-badge-options <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  821. <th><?php _e( 'Theme', 'google-one' ); ?></th> 
  822. <td> 
  823. <select name="gglplsn_badge_theme"> 
  824. <option value="light" <?php if ( 'light' == $gglplsn_options['badge_theme'] ) echo 'selected="selected"'; ?>><?php _e( 'Light', 'google-one' ); ?></option> 
  825. <option value="dark" <?php if ( 'dark' == $gglplsn_options['badge_theme'] ) echo 'selected="selected"'; ?>><?php _e( 'Dark', 'google-one' ); ?></option> 
  826. </select> 
  827. </td> 
  828. </tr> 
  829. <tr class="gglplsn-badge-options <?php if ( 0 == $gglplsn_options['badge_js'] ) echo 'gglplsn-hide-option'; ?>"> 
  830. <th><?php _e( 'Width', 'google-one' ); ?></th> 
  831. <td> 
  832. <input type="number" name="gglplsn_badge_width" max="450" <?php echo ( 'portrait' == $gglplsn_options['badge_layout'] ) ? 'min="180"' : 'min="273"'; ?> value="<?php echo $gglplsn_options['badge_width']; ?>" /> 
  833. <?php _e( 'px', 'google-one' ); ?> 
  834. </td> 
  835. </tr> 
  836. </tbody> 
  837. </table> 
  838. <!-- general --> 
  839. <?php if ( ! $bws_hide_premium_options_check ) { ?> 
  840. <div class="bws_pro_version_bloc gglpsn-bottom-pro-block"> 
  841. <div class="bws_pro_version_table_bloc"> 
  842. <button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php _e( 'Close', 'google-one' ); ?>"></button> 
  843. <div class="bws_table_bg"></div> 
  844. <table class="form-table bws_pro_version"> 
  845. <tr valign="top" class="gglplsn-pro-version-preview"> 
  846. <th> 
  847. <h3><?php _e( 'Preview', 'google-one' ) ?></h3> 
  848. </th> 
  849. <td> 
  850. <img src="<?php echo plugin_dir_url( __FILE__ ); ?>/images/preview_screenshot.png"> 
  851. </td> 
  852. </tr> 
  853. </table> 
  854. </div> 
  855. <div class="bws_pro_version_tooltip"> 
  856. <a class="bws_button" href="http://bestwebsoft.com/products/wordpress/plugins/google-plus-one/?k=0a5a8a70ed3c34b95587de0604ca9517&pn=102&v=<?php echo $gglplsn_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="Google +1 Pro"><?php _e( 'Learn More', 'google-one' ); ?></a> 
  857. <div class="clear"></div> 
  858. </div> 
  859. </div> 
  860. <div class="gglplsn-preview-wrap"> 
  861. <button type="submit" name="bws_hide_premium_options" class="notice-dismiss bws_hide_premium_options" title="<?php _e( 'Close', 'google-one' ); ?>"></button> 
  862. <div class="bws_table_bg"></div> 
  863. <h3><?php _e( 'Preview', 'google-one' ) ?></h3> 
  864. <img src="<?php echo plugin_dir_url( __FILE__ ); ?>/images/preview_screenshot.png"> 
  865. <div class="bws_pro_version_tooltip"> 
  866. <a class="bws_button" href="http://bestwebsoft.com/products/wordpress/plugins/google-plus-one/?k=0a5a8a70ed3c34b95587de0604ca9517&pn=102&v=<?php echo $gglplsn_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="Google +1 Pro"><?php _e( 'Learn More', 'google-one' ); ?></a> 
  867. <div class="clear"></div> 
  868. </div> 
  869. </div> 
  870. <?php } ?> 
  871. <!-- end general --> 
  872. <p class="submit"> 
  873. <input id="bws-submit-button" type="submit" value="<?php _e( 'Save Changes', 'google-one' ); ?>" class="button-primary" /> 
  874. <input type="hidden" name="gglplsn_form_submit" value="1" /> 
  875. <?php wp_nonce_field( $plugin_basename, 'gglplsn_nonce_name' ); ?> 
  876. </p> 
  877. </form> 
  878. </div> 
  879. </div> 
  880. <!-- general --> 
  881. <?php bws_form_restore_default_settings( $plugin_basename ); 
  882. } elseif ( 'custom_code' == $_GET['action'] ) { 
  883. bws_custom_code_tab(); 
  884. } /**pls extra banner */ elseif ( 'extra' == $_GET['action'] ) { ?> 
  885. <div class="bws_pro_version_bloc"> 
  886. <div class="bws_pro_version_table_bloc"> 
  887. <div class="bws_table_bg"></div> 
  888. <div class="bws_pro_version"> 
  889. <?php _e( 'Please choose the necessary post types (or single pages) where Google button will be displayed:', 'google-one' ); ?> 
  890. <p> 
  891. <input disabled="disabled" checked="checked" id="twttrpr_jstree_url" type="checkbox" name="twttrpr_jstree_url" value="1" /> 
  892. <?php _e( "Show URL for pages", 'google-one' );?> 
  893. </p> 
  894. <img src="<?php echo plugins_url( 'images/pro_screen_1.png', __FILE__ ); ?>" alt="<?php _e( "Example of the site's pages tree", 'google-one' ); ?>" title="<?php _e( "Example of the site's pages tree", 'google-one' ); ?>" /> 
  895. <p> 
  896. <strong>* <?php _e( 'If you upgrade to Pro version all your settings will be saved.', 'google-one' ); ?></strong> 
  897. </p> 
  898. </div> 
  899. </div> 
  900. <div class="bws_pro_version_tooltip"> 
  901. <a class="bws_button" href="http://bestwebsoft.com/products/wordpress/plugins/google-plus-one/?k=0a5a8a70ed3c34b95587de0604ca9517&pn=102&v=<?php echo $gglplsn_plugin_info["Version"]; ?>&wp_v=<?php echo $wp_version; ?>" target="_blank" title="Google +1 Pro"><?php _e( 'Learn More', 'google-one' ); ?></a> 
  902. <div class="clear"></div> 
  903. </div> 
  904. </div> 
  905. <?php } elseif ( 'go_pro' == $_GET['action'] ) { 
  906. bws_go_pro_tab_show( $bws_hide_premium_options_check, $gglplsn_plugin_info, $plugin_basename, 'google-plus-one.php', 'google-plus-one-pro.php', 'google-one-pro/google-plus-one-pro.php', 'google-plus-one', '0a5a8a70ed3c34b95587de0604ca9517', '102', isset( $go_pro_result['pro_plugin_is_activated'] ) ); 
  907. bws_plugin_reviews_block( $gglplsn_plugin_info['Name'], 'google-one' ); /** show reviews block pls*/ ?> 
  908. </div> 
  909. <!-- end general --> 
  910. <?php } 
  911.  
  912. if ( ! function_exists( 'gglplsn_admin_head' ) ) { 
  913. function gglplsn_admin_head() { 
  914. global $hook_suffix, $gglplsn_is_button_shown, $gglplsn_plugin_info; 
  915. if ( isset( $_GET['page'] ) && ( "google-plus-one.php" == $_GET['page'] || "social-buttons.php" == $_GET['page'] ) ) { 
  916. if ( isset( $_GET['action'] ) && 'custom_code' == $_GET['action'] ) { 
  917. bws_plugins_include_codemirror(); 
  918. wp_enqueue_style( 'gglplsn_style', plugins_url( 'css/style.css', __FILE__ ), array(), $gglplsn_plugin_info['Version'] ); 
  919. /** Loclize script */ 
  920. wp_enqueue_script( 'gglplsn-script', plugins_url( 'js/script.js' , __FILE__ ), array( 'jquery' ), $gglplsn_plugin_info['Version'] ); 
  921. $js_strings = array( 
  922. 'already_added' => __( 'Is already added', 'google-one' ),  
  923. 'one_number' => __( 'Only one phone number can be added', 'google-one' ),  
  924. 'number_added' => __( "You can't add the invitation because the phone number is already added", 'google-one' ),  
  925. 'any_added' => __( "You can't add the phone number because another invitation type is already added", 'google-one' ),  
  926. 'empty_id' => __( "This field can't be empty", 'google-one' ),  
  927. 'invalid_email' => __( 'Please, enter the valid Email', 'google-one' ),  
  928. 'email_th' => __( 'Email of Invited Person', 'google-one' ),  
  929. 'email_info' => __( 'Please, enter the Email of invited person, e.g.', 'google-one' ) . ' "example@gmail.com"',  
  930. 'phone_th' => __( 'Phone Number of Invited Person', 'google-one' ),  
  931. 'phone_info' => __( 'Please, enter the phone number of invited person, e.g.', 'google-one' ) . ' "+38001234567"',  
  932. 'profile_th' => __( 'Google+ Profile ID of Invited Person', 'google-one' ),  
  933. 'profile_info' => __( 'Please, enter the Google+ Profile ID of invited person, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+YouName"',  
  934. 'circle_th' => __( 'Google+ Circle ID for Invitation', 'google-one' ),  
  935. 'circle_info' => __( 'Please, enter the Google+ Circle ID for invitation, e.g.', 'google-one' ) . ' "123ab345cd576ef7"',  
  936. 'person_id_th' => __( 'Google+ ID', 'google-one' ),  
  937. 'person_id_info' => __( 'Enter the Google+ ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+YouName"',  
  938. 'page_id_th' => __( 'Google+ Page ID', 'google-one' ),  
  939. 'page_id_info' => __( 'Enter the Google+ Page ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+CompanyName"',  
  940. 'community_id_th' => __( 'Google+ Community ID', 'google-one' ),  
  941. 'community_id_info' => __( 'Enter the Google+ Community ID, e.g.', 'google-one' ) . ' "12345678912345678912" ' . __( 'or', 'google-one' ) . ' "+CommunityName"',  
  942. 'person_tagline_info' => __( "Display the user's tag line", 'google-one' ),  
  943. 'page_tagline_info' => __( 'Display the company tag line', 'google-one' ),  
  944. 'community_tagline_info' => __( 'Display the community tag line', 'google-one' ),  
  945. 'gglplsn_ajax_nonce' => wp_create_nonce( 'gglplsn_ajax_nonce' ) 
  946. ); 
  947. wp_localize_script( 'gglplsn-script', 'js_string', $js_strings ); 
  948. } elseif ( 'widgets.php' == $hook_suffix ) { 
  949. wp_enqueue_script( 'gglplsn-widgets-script', plugins_url( 'js/widgets-script.js' , __FILE__ ), array( 'jquery' ), $gglplsn_plugin_info['Version'] ); 
  950. } elseif ( ! is_admin() && ( ! empty( $gglplsn_is_button_shown ) || defined( 'BWS_ENQUEUE_ALL_SCRIPTS' ) ) ) { 
  951. wp_enqueue_style( 'gglplsn_style', plugins_url( 'css/style.css', __FILE__ ), array(), $gglplsn_plugin_info['Version'] ); 
  952.  
  953. if ( ! function_exists( 'gglplsn_footer_actions' ) ) { 
  954. function gglplsn_footer_actions() { 
  955. gglplsn_js(); 
  956. gglplsn_admin_head(); 
  957.  
  958. if ( ! function_exists( 'gglplsn_pagination_callback' ) ) { 
  959. function gglplsn_pagination_callback( $content ) { 
  960. $content .= "if ( typeof gapi !== 'undefined' ) { 
  961. gapi.plusone.go(); 
  962. gapi.plus.go(); 
  963. gapi.follow.go(); 
  964. gapi.hangout.go(); 
  965. gapi.person.go(); 
  966. gapi.page.go(); 
  967. gapi.community.go(); 
  968. }"; 
  969. return $content; 
  970.  
  971. if ( ! function_exists( 'gglplsn_js' ) ) { 
  972. function gglplsn_js() { 
  973. global $gglplsn_is_button_shown; 
  974. if ( ! empty( $gglplsn_is_button_shown ) || defined( 'BWS_ENQUEUE_ALL_SCRIPTS' ) ) { 
  975. global $gglplsn_options, $gglplsn_lang_codes; 
  976. if ( 
  977. 1 == $gglplsn_options['plus_one_js'] || 
  978. 1 == $gglplsn_options['share_js'] || 
  979. 1 == $gglplsn_options['follow_js'] || 
  980. 1 == $gglplsn_options['hangout_js'] || 
  981. 1 == $gglplsn_options['badge_js'] 
  982. ) { 
  983. if ( 1 == $gglplsn_options['use_multilanguage_locale'] && isset( $_SESSION['language'] ) ) { 
  984. if ( array_key_exists( $_SESSION['language'], $gglplsn_lang_codes ) ) { 
  985. $gglplsn_locale = $_SESSION['language']; 
  986. } else { 
  987. $gglplsn_locale_from_multilanguage = str_replace( '_', '-', $_SESSION['language'] ); 
  988. if ( array_key_exists( $gglplsn_locale_from_multilanguage, $gglplsn_lang_codes ) ) { 
  989. $gglplsn_locale = $gglplsn_locale_from_multilanguage; 
  990. } else { 
  991. $gglplsn_locale_from_multilanguage = explode( '_', $_SESSION['language'] ); 
  992. if( is_array( $gglplsn_locale_from_multilanguage ) && array_key_exists( $gglplsn_locale_from_multilanguage[0], $gglplsn_lang_codes ) ) 
  993. $gglplsn_locale = $gglplsn_locale_from_multilanguage[0]; 
  994. if ( empty( $gglplsn_locale ) ) 
  995. $gglplsn_locale = $gglplsn_options['lang']; ?> 
  996. <script type="text/javascript"> 
  997. window.___gcfg = { 
  998. lang: '<?php echo $gglplsn_locale; ?>',  
  999. }; 
  1000. </script> 
  1001. <script type="text/javascript" src="https://apis.google.com/js/plusone.js" async defer></script> 
  1002. <?php } ?> 
  1003. <?php } 
  1004.  
  1005. /** Google Buttons on page */ 
  1006. if ( ! function_exists( 'gglplsn_button_content' ) ) { 
  1007. function gglplsn_button_content() { 
  1008. global $gglplsn_options; 
  1009.  
  1010. $plus_one = ( 1 == $gglplsn_options['plus_one_js'] ) ? gglplsn_return_button( 'plusone', $gglplsn_options ) : ''; 
  1011. $share = ( 1 == $gglplsn_options['share_js'] ) ? gglplsn_return_button( 'share', $gglplsn_options ) : ''; 
  1012. $follow = ( 1 == $gglplsn_options['follow_js'] ) ? gglplsn_return_button( 'follow', $gglplsn_options ) : ''; 
  1013. $hangout = ( 1 == $gglplsn_options['hangout_js'] ) ? gglplsn_return_button( 'hangout', $gglplsn_options ) : ''; 
  1014. $badge = ( 1 == $gglplsn_options['badge_js'] ) ? gglplsn_return_button( 'badge', $gglplsn_options ) : ''; 
  1015. return $badge . $hangout . $plus_one . $follow . $share; 
  1016.  
  1017. if ( ! function_exists( 'gglplsn_pos' ) ) { 
  1018. function gglplsn_pos( $content ) { 
  1019. global $gglplsn_options, $gglplsn_is_button_shown; 
  1020.  
  1021. if ( is_feed() ) 
  1022. return $content; 
  1023. $button_content = gglplsn_button_content(); 
  1024. if ( 
  1025. ! empty( $button_content ) && 
  1026. ( ! empty( $gglplsn_options['posts'] ) || ! empty( $gglplsn_options['pages'] ) || ! empty( $gglplsn_options['homepage'] ) ) 
  1027. ) { 
  1028. if ( ! is_home() && ! is_front_page() ) { 
  1029. if ( ( is_single() && ! empty( $gglplsn_options['posts'] ) ) || ( is_page() && ! empty( $gglplsn_options['pages'] ) ) ) { 
  1030. $button = '<div class="gglplsn_buttons">' . $button_content . '</div>'; 
  1031. } elseif ( ! empty( $gglplsn_options['homepage'] ) ) { 
  1032. $button = '<div class="gglplsn_buttons">' . $button_content . '</div>'; 
  1033.  
  1034. if ( ! empty( $button ) ) { 
  1035. $gglplsn_is_button_shown = true; 
  1036. if ( 'before_post' == $gglplsn_options['position'] ) { 
  1037. return $button . $content; 
  1038. } elseif ( 'after_post' == $gglplsn_options['position'] ) { 
  1039. return $content . $button; 
  1040. } elseif ( 'afterandbefore' == $gglplsn_options['position'] ) { 
  1041. return $button . $content . $button; 
  1042. } elseif ( 'only_shortcode' == $gglplsn_options['position'] ) { 
  1043. return $content; 
  1044. return $content; 
  1045.  
  1046. /** Badge Widget */ 
  1047. if ( ! class_exists( 'Gglplsn_Badge_Widget' ) ) { 
  1048. class Gglplsn_Badge_Widget extends WP_Widget { 
  1049. function __construct() { 
  1050. parent::__construct( 'gglplsn_badge', __( 'Google+ Badge Widget', 'google-one' ), array( 'description' => __( 'Show Google Badge on your site', 'google-one' ) ) ); 
  1051.  
  1052. function widget( $args, $instance ) { 
  1053. global $gglplsn_options, $gglplsn_is_button_shown; 
  1054.  
  1055. if ( ! isset( $instance['badge_layout'] ) ) { 
  1056. $instance['badge_layout'] = $gglplsn_options['badge_layout']; 
  1057.  
  1058. if ( ! isset( $instance['badge_show_cover'] ) ) { 
  1059. $instance['badge_show_cover'] = $gglplsn_options['badge_show_cover']; 
  1060. $instance['badge_id'] = ! empty( $instance['badge_id'] ) ? esc_html( $instance['badge_id'] ) : esc_html( $gglplsn_options['badge_id'] ); 
  1061. $instance['badge_type'] = ! empty( $instance['badge_type'] ) ? esc_html( $instance['badge_type'] ) : esc_html( $gglplsn_options['badge_type'] ); 
  1062. $instance['badge_show_tagline'] = ! empty( $instance['badge_show_tagline'] ) ? true : false; 
  1063. $instance['badge_show_owners'] = ! empty( $instance['badge_show_owners'] ) ? true : false; 
  1064. $instance['badge_theme'] = ! empty( $instance['badge_theme'] ) ? esc_html( $instance['badge_theme'] ) : esc_html( $gglplsn_options['badge_theme'] ); 
  1065. $instance['badge_width'] = ! empty( $instance['badge_width'] ) ? intval( $instance['badge_width'] ) : intval( $gglplsn_options['badge_width'] ); 
  1066. $title = ( ! empty( $instance['title'] ) ) ? apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) : ''; 
  1067. echo $args['before_widget']; 
  1068. if ( ! empty( $title ) ) { 
  1069. echo $args['before_title'] . $title . $args['after_title']; 
  1070. $badge = gglplsn_return_button( 'badge', $instance ); 
  1071. echo $badge; 
  1072. echo $args['after_widget']; 
  1073. $gglplsn_is_button_shown = true; 
  1074.  
  1075. function update( $new_instance, $old_instance ) { 
  1076. $instance = $old_instance; 
  1077. $instance['title'] = strip_tags( $new_instance['title'] ); 
  1078. $instance['badge_id'] = esc_html( $new_instance['badge_id'] ); 
  1079. $instance['badge_type'] = $new_instance['badge_type']; 
  1080. $instance['badge_layout'] = $new_instance['badge_layout']; 
  1081. $instance['badge_show_cover'] = isset( $new_instance['badge_show_cover'] ) ? true : false; 
  1082. $instance['badge_show_tagline'] = isset( $new_instance['badge_show_tagline'] ) ? true : false; 
  1083. $instance['badge_show_owners'] = isset( $new_instance['badge_show_owners'] ) ? true : false; 
  1084. $instance['badge_width'] = isset( $new_instance['badge_width'] ) ? intval( $new_instance['badge_width'] ) : 270; 
  1085. return $instance; 
  1086.  
  1087. function form( $instance ) { 
  1088. global $gglplsn_options; 
  1089. if ( empty( $gglplsn_options ) ) { 
  1090. $gglplsn_options = get_option( 'gglplsn_options' ); 
  1091.  
  1092. if ( ! empty( $instance ) ) { 
  1093. $title = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 
  1094. $badge_id = ! empty( $instance['badge_id'] ) ? esc_html( $instance['badge_id'] ) : ''; 
  1095. $badge_type = ! empty( $instance['badge_type'] ) ? esc_html( $instance['badge_type'] ) : ''; 
  1096. $badge_layout = ! empty( $instance['badge_layout'] ) ? $instance['badge_layout'] : 'portrait'; 
  1097. $badge_show_cover = ! empty( $instance['badge_show_cover'] ) ? true : false; 
  1098. $badge_show_tagline = ! empty( $instance['badge_show_tagline'] ) ? true : false; 
  1099. $badge_show_owners = ( ! empty( $instance['badge_show_owners'] ) && 'community' == $badge_type ) ? true : false; 
  1100. $badge_width = ! empty( $instance['badge_width'] ) ? intval( $instance['badge_width'] ) : 180; 
  1101. } else { 
  1102. $title = ''; 
  1103. $badge_id = ! empty( $gglplsn_options['badge_id'] ) ? esc_html( $gglplsn_options['badge_id'] ) : ''; 
  1104. $badge_type = ! empty( $gglplsn_options['badge_type'] ) ? esc_html( $gglplsn_options['badge_type'] ) : ''; 
  1105. $badge_layout = ! empty( $gglplsn_options['badge_layout'] ) ? $gglplsn_options['badge_layout'] : 'portrait'; 
  1106. $badge_show_cover = ! empty( $gglplsn_options['badge_show_cover'] ) ? true : false; 
  1107. $badge_show_tagline = ! empty( $gglplsn_options['badge_show_tagline'] ) ? true : false; 
  1108. $badge_show_owners = ( ! empty( $gglplsn_options['badge_show_owners'] ) && 'community' == $badge_type ) ? true : false; 
  1109. $badge_width = ! empty( $gglplsn_options['badge_width'] ) ? intval( $gglplsn_options['badge_width'] ) : 180; 
  1110. } ?> 
  1111.  
  1112. <p> 
  1113. <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'google-one' ); ?>:</label> 
  1114. <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> 
  1115. </p> 
  1116. <p> 
  1117. <label for="<?php echo $this->get_field_id( 'badge_id' ); ?>"><?php _e( 'Google+ ID', 'google-one' ); ?>:</label> 
  1118. <input type="text" class="widefat" name="<?php echo $this->get_field_name( 'badge_id' ); ?>" <?php echo 'required="required"'; ?> value="<?php echo $badge_id; ?>" /> 
  1119. <span class="bws_info gglplsn-badge-id-info">(<?php echo __( 'Enter the Google+ ID, e.g.', 'google-one' ) . ' "12345678912345678912" '; ?>)</span> 
  1120. </p> 
  1121. <p> 
  1122. <label for="<?php echo $this->get_field_id( 'badge_type' ); ?>"><?php _e( 'Type', 'google-one' ); ?></label> 
  1123. <select id="<?php echo $this->get_field_id( 'badge_type' ); ?>" class="gglplsn-badge-type" name="<?php echo $this->get_field_name( 'badge_type' ); ?>"> 
  1124. <option value="person" <?php if ( 'person' == $badge_type ) echo 'selected="selected"'; ?>><?php _e( 'Person', 'google-one' ); ?></option> 
  1125. <option value="page" <?php if ('page' == $badge_type ) echo 'selected="selected"'; ?>><?php _e( 'Page', 'google-one' ); ?></option> 
  1126. <option value="community" <?php if ( 'community' == $badge_type ) echo 'selected="selected"'; ?>><?php _e( 'Community', 'google-one' ); ?></option> 
  1127. </select> 
  1128. </p> 
  1129. <p> 
  1130. <label for="<?php echo $this->get_field_id( 'badge_layout' ); ?>"><?php _e( 'Layout', 'google-one' ); ?></label> 
  1131. <select id="<?php echo $this->get_field_id( 'badge_layout' ); ?>" name="<?php echo $this->get_field_name( 'badge_layout' ); ?>"> 
  1132. <option value="portrait" <?php if ( 'portrait' == $badge_layout ) echo 'selected="selected"';?>><?php _e( 'Portrait', 'google-one' ); ?></option> 
  1133. <option value="landscape" <?php if ( 'landscape' == $badge_layout ) echo 'selected="selected"';?>><?php _e( 'Landscape', 'google-one' ); ?></option> 
  1134. </select> 
  1135. </p> 
  1136. <p> 
  1137. <input class="widefat" id="<?php echo $this->get_field_id( 'badge_show_cover' ); ?>" name="<?php echo $this->get_field_name( 'badge_show_cover' ); ?>" type="checkbox" <?php if ( true == $badge_show_cover ) echo 'checked="checked"'; ?> value="1" /> 
  1138. <label for="<?php echo $this->get_field_id( 'badge_show_cover' ); ?>"><?php _e( 'Show Cover Photo', 'google-one' ); ?></label> 
  1139. </p> 
  1140. <p> 
  1141. <input class="widefat" id="<?php echo $this->get_field_id( 'badge_show_tagline' ); ?>" name="<?php echo $this->get_field_name( 'badge_show_tagline' ); ?>" type="checkbox" <?php if ( true == $badge_show_tagline ) echo 'checked="checked"'; ?> value="1" /> 
  1142. <label for="<?php echo $this->get_field_id( 'badge_show_tagline' ); ?>"><?php _e( 'Show Tag Line', 'google-one' ); ?></label> 
  1143. </p> 
  1144.  
  1145. <p <?php echo ( 'community' != $badge_type ) ? 'class="gglplsn-show-owners hidden"' : 'class="gglplsn-show-owners"'; ?>> 
  1146. <input class="widefat" id="<?php echo $this->get_field_id( 'badge_show_owners' ); ?>" name="<?php echo $this->get_field_name( 'badge_show_owners' ); ?>" type="checkbox"<?php if ( true == $badge_show_owners ) echo ' checked="checked"'; echo ( 'community' != $badge_type ) ? ' disabled="disabled"': ''; ?> value="1" /> 
  1147. <label for="<?php echo $this->get_field_id( 'badge_show_owners' ); ?>"><?php _e( 'Show Owners', 'google-one' ); ?></label> 
  1148. </p> 
  1149. <p> 
  1150. <label for="<?php echo $this->get_field_id( 'badge_width' ); ?>"><?php _e( 'Width', 'google-one' ); ?></label> 
  1151. <input type="number" id="<?php echo $this->get_field_id( 'badge_width' ); ?>" name="<?php echo $this->get_field_name( 'badge_width' ); ?>" max="450" <?php echo ( 'portrait' == $badge_layout ) ? 'min="180"' : 'min="273"'; ?> value="<?php echo $badge_width; ?>" /> 
  1152. <?php _e( 'px', 'google-one' ); ?> 
  1153. </p> 
  1154. <?php } 
  1155.  
  1156. if ( ! function_exists( 'gglplsn_register_badge_widget' ) ) { 
  1157. function gglplsn_register_badge_widget() { 
  1158. register_widget( 'Gglplsn_Badge_Widget' ); 
  1159.  
  1160. /** Function for forming buttons tags */ 
  1161. if ( ! function_exists( 'gglplsn_return_button' ) ) { 
  1162. function gglplsn_return_button( $request, $options ) { 
  1163. extract( $options ); 
  1164. if ( 'plusone' == $request ) { 
  1165. switch( $plus_one_size ) { 
  1166. case 'standard' : 
  1167. $plus_one_width = ( 'standard' == $plus_one_annotation_type ) ? 189 : 139; 
  1168. break; 
  1169. case 'small' : 
  1170. $plus_one_width = ( 'standard' == $plus_one_annotation_type ) ? 185 : 129; 
  1171. break; 
  1172. case 'medium' : 
  1173. $plus_one_width = ( 'standard' == $plus_one_annotation_type ) ? 183 : 133; 
  1174. break; 
  1175. case 'tall' : 
  1176. $plus_one_width = ( 'standard' == $plus_one_annotation_type ) ? 201 : 151; 
  1177. break; 
  1178.  
  1179. $plus_one = '<span class="gglplsn_plus_one"><g:plusone 
  1180. size="' . $plus_one_size . '" 
  1181. '. ( ( 'inline' == $plus_one_annotation ) ? 'width="' . $plus_one_width . '"' : "" ) . 
  1182. 'annotation="' . $plus_one_annotation . '" 
  1183. callback="on" 
  1184. href="' . get_permalink() . '"></g:plusone></span>'; 
  1185. return $plus_one; 
  1186.  
  1187. if ( 'share' == $request ) { 
  1188. switch( $share_size ) { 
  1189. case 20 : 
  1190. $share_width = ( 'standard' == $share_annotation_type ) ? 200 : 150; 
  1191. break; 
  1192. case 15 : 
  1193. $share_width = ( 'standard' == $share_annotation_type ) ? 205 : 140; 
  1194. break; 
  1195. case 24 : 
  1196. $share_width = ( 'standard' == $share_annotation_type ) ? 206 : 150; 
  1197. break; 
  1198.  
  1199. $share = '<span class="gglplsn_share"><g:plus action="share" 
  1200. href="'. get_permalink() . '" 
  1201. '. ( ( 'vertical-bubble' != $share_annotation ) ? 'height="' . $share_size . '"' : "" ) . ' 
  1202. annotation="' . $share_annotation .'" 
  1203. '. ( ( 'inline' == $share_annotation ) ? 'width="' . $share_width . '"' : "" ) . '> </span></span>'; 
  1204. return $share; 
  1205.  
  1206. if ( 'follow' == $request ) { 
  1207. $follow_id = sanitize_text_field( $follow_id ); 
  1208. if ( ! empty( $follow_id ) ) { 
  1209. $href = 'https://plus.google.com/' . $follow_id; 
  1210. $follow = '<span class="gglplsn_follow"><g:follow 
  1211. href="' . esc_url( $href ) . '" 
  1212. height="' . intval( $follow_size ) . '" 
  1213. annotation="' . $follow_annotation .'" 
  1214. rel="' . $follow_relationship . '"></g:follow></span>'; 
  1215. return $follow; 
  1216. } else { 
  1217. return ''; 
  1218.  
  1219. if ( 'hangout' == $request ) { 
  1220. $hangout_topic_string = ( 1 == $hangout_topic_title ) ? get_the_title() : sanitize_text_field( $hangout_topic ); 
  1221. $hangout_invite = ""; 
  1222. if ( ! empty( $hangout_invite_type ) ) { 
  1223. foreach( $hangout_invite_type as $key => $value ) { 
  1224. $hangout_invite .= "{ id : '" . $hangout_invite_id[ $key ] . "', invite_type : '" . sanitize_text_field( $value ) . "' }, "; 
  1225. if ( 'standard' != $hangout_size ) { 
  1226. $hangout_width = ( 'narrow' == $hangout_size ) ? 72 : 175; 
  1227.  
  1228. $hangout = '<span class="gglplsn_hangout"><g:hangout 
  1229. render="createhangout" 
  1230. topic="' . $hangout_topic_string . '" 
  1231. hangout_type="' . $hangout_type . '" 
  1232. '. ( ( 'standard' != $hangout_size ) ? 'widget_size="' . $hangout_width . '"' : "" ) . ' 
  1233. invites="[' . $hangout_invite . ']"></g:hangout></span>'; 
  1234. return $hangout; 
  1235.  
  1236. if ( 'badge' == $request ) { 
  1237. $badge_id = esc_html( $badge_id ); 
  1238. if ( ! empty( $badge_id ) ) { 
  1239. $href = 'https://plus.google.com/' . ( 'community' == $badge_type ? 'communities/': '' ) . $badge_id; 
  1240. $photo = ( ( 'community' != $badge_type ) ? 'showcoverphoto="' : 'showphoto="' ) . $badge_show_cover . '"'; 
  1241. $badge_width = intval( $badge_width ); 
  1242. if ( $badge_width < 180 && 'portrait' == $badge_layout ) { 
  1243. $badge_width = 180; 
  1244. } elseif ( $badge_width < 273 && 'landscape' == $badge_layout ) { 
  1245. $badge_width = 273; 
  1246. } elseif ( $badge_width > 450 ) { 
  1247. $badge_width = 450; 
  1248.  
  1249. $badge = '<p class="gglplsn_badge"><g:' . $badge_type . ' 
  1250. href="' . esc_url( $href ) . '" 
  1251. layout="' . $badge_layout . '" 
  1252. width="' . $badge_width . '" 
  1253. theme="' . $badge_theme . '" 
  1254. ' . $photo . ' 
  1255. showowners="' . $badge_show_owners . '" 
  1256. showtagline="' . $badge_show_tagline . '"></g:' . $badge_type . '></p>'; 
  1257. return $badge; 
  1258. } else { 
  1259. return ''; 
  1260.  
  1261. /** Google +1 shortcode */ 
  1262. /** [bws_googleplusone] */ 
  1263. if ( ! function_exists( 'gglplsn_shortcode' ) ) { 
  1264. function gglplsn_shortcode( $atts ) { 
  1265. global $gglplsn_options, $gglplsn_is_button_shown; 
  1266.  
  1267. $buttons = ''; 
  1268. $shortcode_atts = shortcode_atts( array( 'display' => 'plusone' ), $atts ); 
  1269. $shortcode_atts = ( str_word_count( $shortcode_atts['display'], 1 ) ); 
  1270. foreach ( $shortcode_atts as $value ) { 
  1271. if ( 'plusone' === $value ) { 
  1272. $buttons .= gglplsn_return_button( 'plusone', $gglplsn_options ); 
  1273.  
  1274. if ( 'share' === $value ) { 
  1275. $buttons .= gglplsn_return_button( 'share', $gglplsn_options ); 
  1276.  
  1277. if ( 'follow' === $value ) { 
  1278. $buttons .= gglplsn_return_button( 'follow', $gglplsn_options ); 
  1279.  
  1280. if ( 'hangout' === $value ) { 
  1281. $buttons .= gglplsn_return_button( 'hangout', $gglplsn_options ); 
  1282.  
  1283. if ( 'badge' === $value ) { 
  1284. $buttons .= gglplsn_return_button( 'badge', $gglplsn_options ); 
  1285. if ( ! empty( $buttons ) ) { 
  1286. $gglplsn_is_button_shown = true; 
  1287. return $buttons; 
  1288.  
  1289. /** add shortcode content */ 
  1290. if ( ! function_exists( 'gglplsn_shortcode_button_content' ) ) { 
  1291. function gglplsn_shortcode_button_content( $content ) { 
  1292. global $wp_version, $gglplsn_options; 
  1293. if ( empty( $gglplsn_options ) ) 
  1294. $gglplsn_options = get_option( 'gglplsn_options' ); ?> 
  1295. <div id="gglplsn" style="display:none;"> 
  1296. <fieldset> 
  1297. <?php _e( 'Add Google Buttons to your page or post', 'google-one' ); ?> 
  1298. <br /> 
  1299. <label> 
  1300. <input type="checkbox" name="gglplsn_selected_plusone" value="plusone" checked="checked" /> 
  1301. <?php _e( 'Google +1', 'google-one' ) ?> 
  1302. </label> 
  1303. <br /> 
  1304. <label> 
  1305. <input type="checkbox" name="gglplsn_selected_share" value="share" /> 
  1306. <?php _e( 'Share', 'google-one' ) ?> 
  1307. </label> 
  1308. <br /> 
  1309. <label> 
  1310. <input type="checkbox" name="gglplsn_selected_follow" value="follow" /> 
  1311. <?php _e( 'Follow', 'google-one' ); ?> 
  1312. <?php if ( empty( $gglplsn_options['follow_id'] ) ) { ?> 
  1313. <span class="bws_info"> 
  1314. (<?php _e( 'To see this button, please', 'google-one' ); ?> 
  1315. <a style="color: #0073aa;" href="admin.php?page=google-plus-one.php"><?php _e( 'enter', 'google-one' ) ?></a> 
  1316. <?php _e( 'the Google+ ID', 'google-one' ); ?>) 
  1317. </span> 
  1318. <?php } ?> 
  1319. </label> 
  1320. <br /> 
  1321. <label> 
  1322. <input type="checkbox" name="gglplsn_selected_hangout" value="hangout" /> 
  1323. <?php _e( 'Hangout', 'google-one' ) ?> 
  1324. </label> 
  1325. <br /> 
  1326. <label> 
  1327. <input type="checkbox" name="gglplsn_selected_badge" value="badge" /> 
  1328. <?php _e( 'Badge', 'google-one' ); ?> 
  1329. <?php if ( empty( $gglplsn_options['badge_id'] ) ) { ?> 
  1330. <span class="bws_info"> 
  1331. (<?php _e( 'To see this button, please', 'google-one' ); ?> 
  1332. <a style="color: #0073aa;" href="admin.php?page=google-plus-one.php"><?php _e( 'enter', 'google-one' ) ?></a> 
  1333. <?php _e( 'the Google+ ID', 'google-one' ); ?>) 
  1334. </span> 
  1335. <?php } ?> 
  1336. </label> 
  1337. <input class="bws_default_shortcode" type="hidden" name="default" value="[bws_googleplusone]" /> 
  1338. <div class="clear"></div> 
  1339. </fieldset> 
  1340. </div> 
  1341. <script type="text/javascript"> 
  1342. function gglplsn_shortcode_init() { 
  1343. ( function( $ ) { 
  1344. var current_object = '<?php echo ( $wp_version < 3.9 ) ? "#TB_ajaxContent" : ".mce-reset"; ?>'; 
  1345. $( current_object + ' input[name^="gglplsn_selected"]' ).change( function() { 
  1346. var result = ''; 
  1347. $( current_object + ' input[name^="gglplsn_selected"]' ).each( function() { 
  1348. if ( $( this ).is( ':checked' ) ) { 
  1349. result += $( this ).val() + ', '; 
  1350. } ); 
  1351. if ( '' == result ) { 
  1352. $( current_object + ' #bws_shortcode_display' ).text( '' ); 
  1353. } else { 
  1354. result = result.slice( 0, - 1 ); 
  1355. $( current_object + ' #bws_shortcode_display' ).text( '[bws_googleplusone display="' + result + '"]' ); 
  1356. } ); 
  1357. } ) ( jQuery ); 
  1358. </script> 
  1359. <?php } 
  1360.  
  1361. /** Validate email for Hangout invites */ 
  1362. if ( ! function_exists( 'gglplsn_validate_email' ) ) { 
  1363. function gglplsn_validate_email() { 
  1364. check_ajax_referer( 'gglplsn_ajax_nonce', 'gglplsn_nonce' ); 
  1365. if ( isset( $_POST['gglplsn_email_for_validate'] ) ) { 
  1366. echo json_encode( array( 'gglplsn_email_validate' => is_email( $_POST['gglplsn_email_for_validate'] ) ) ); 
  1367. wp_die(); 
  1368.  
  1369. /**## Functions creates other links on plugins page. */ 
  1370. if ( ! function_exists( 'gglplsn_action_links' ) ) { 
  1371. function gglplsn_action_links( $links, $file ) { 
  1372. if ( ! is_network_admin() ) { 
  1373. static $this_plugin; 
  1374. if ( ! $this_plugin ) 
  1375. $this_plugin = plugin_basename( __FILE__ ); 
  1376. if ( $file == $this_plugin && ! is_plugin_active( 'google-one-pro/google-plus-one-pro.php' ) && ! is_plugin_active( 'social-buttons-pack/social-buttons-pack.php' ) ) { 
  1377. $settings_link = '<a href="admin.php?page=google-plus-one.php">' . __( 'Settings', 'google-one' ) . '</a>'; 
  1378. array_unshift( $links, $settings_link ); 
  1379. return $links; 
  1380.  
  1381. if ( ! function_exists( 'gglplsn_register_plugin_links' ) ) { 
  1382. function gglplsn_register_plugin_links( $links, $file ) { 
  1383. $base = plugin_basename( __FILE__ ); 
  1384. if ( $file == $base ) { 
  1385. if ( ! is_network_admin() && ! is_plugin_active( 'google-one-pro/google-plus-one-pro.php' ) && ! is_plugin_active( 'social-buttons-pack/social-buttons-pack.php' ) ) 
  1386. $links[] = '<a href="admin.php?page=google-plus-one.php">' . __( 'Settings', 'google-one' ) . '</a>'; 
  1387. $links[] = '<a href="http://wordpress.org/plugins/google-one/faq/" target="_blank">' . __( 'FAQ', 'google-one' ) . '</a>'; 
  1388. $links[] = '<a href="http://support.bestwebsoft.com">' . __( 'Support', 'google-one' ) . '</a>'; 
  1389. return $links; 
  1390.  
  1391. if ( ! function_exists ( 'gglplsn_plugin_banner' ) ) { 
  1392. function gglplsn_plugin_banner() { 
  1393. global $hook_suffix, $gglplsn_plugin_info, $gglplsn_options; 
  1394. if ( 'plugins.php' == $hook_suffix ) { 
  1395.  
  1396. /**pls show banner go pro */ 
  1397. if ( empty( $gglplsn_options ) ) 
  1398. $gglplsn_options = get_option( 'gglplsn_options' ); 
  1399.  
  1400. if ( isset( $gglplsn_options['first_install'] ) && strtotime( '-1 week' ) > $gglplsn_options['first_install'] ) 
  1401. bws_plugin_banner( $gglplsn_plugin_info, 'gglplsn', 'google-plus-one', 'ca01bbe0edd696fddb27769001fe8084', '102', '//ps.w.org/google-one/assets/icon-128x128.png' ); 
  1402. /** show banner go settings pls*/ 
  1403. if ( ! is_network_admin() ) 
  1404. bws_plugin_banner_to_settings( $gglplsn_plugin_info, 'gglplsn_options', 'google-one', 'admin.php?page=google-plus-one.php' ); 
  1405.  
  1406. if ( isset( $_REQUEST['page'] ) && 'google-plus-one.php' == $_REQUEST['page'] ) { 
  1407. bws_plugin_suggest_feature_banner( $gglplsn_plugin_info, 'gglplsn_options', 'google-one' ); 
  1408.  
  1409. /** add help tab */ 
  1410. if ( ! function_exists( 'gglplsn_add_tabs' ) ) { 
  1411. function gglplsn_add_tabs() { 
  1412. $screen = get_current_screen(); 
  1413. $args = array( 
  1414. 'id' => 'gglplsn',  
  1415. 'section' => '200538809' 
  1416. ); 
  1417. bws_help_tab( $screen, $args ); 
  1418.  
  1419. if ( ! function_exists( 'gglplsn_plugin_activate' ) ) { 
  1420. function gglplsn_plugin_activate() { 
  1421. if ( is_multisite() ) { 
  1422. switch_to_blog( 1 ); 
  1423. register_uninstall_hook( __FILE__, 'gglplsn_uninstall' ); 
  1424. restore_current_blog(); 
  1425. } else { 
  1426. register_uninstall_hook( __FILE__, 'gglplsn_uninstall' ); 
  1427.  
  1428. if ( ! function_exists( 'gglplsn_uninstall' ) ) { 
  1429. function gglplsn_uninstall() { 
  1430. if ( ! function_exists( 'get_plugins' ) ) 
  1431. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  1432. $all_plugins = get_plugins(); 
  1433. if ( ! array_key_exists( 'google-one-pro/google-plus-one-pro.php', $all_plugins ) && ! array_key_exists( 'bws-social-buttons/bws-social-buttons.php', $all_plugins ) ) { 
  1434. if ( function_exists( 'is_multisite' ) && is_multisite() ) { 
  1435. global $wpdb; 
  1436.  
  1437. $old_blog = $wpdb->blogid; 
  1438. /** Get all blog ids */ 
  1439. $blogids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" ); 
  1440. foreach ( $blogids as $blog_id ) { 
  1441. switch_to_blog( $blog_id ); 
  1442. delete_option( 'gglplsn_options' ); 
  1443. switch_to_blog( $old_blog ); 
  1444. } else { 
  1445. delete_option( 'gglplsn_options' ); 
  1446.  
  1447. require_once( dirname( __FILE__ ) . '/bws_menu/bws_include.php' ); 
  1448. bws_include_init( plugin_basename( __FILE__ ) ); 
  1449. bws_delete_plugin( plugin_basename( __FILE__ ) ); 
  1450.  
  1451. register_activation_hook( __FILE__, 'gglplsn_plugin_activate' ); 
  1452.  
  1453. /** Adding 'BWS Plugins' admin menu */ 
  1454. add_action( 'admin_menu', 'gglplsn_admin_menu' ); 
  1455. /** Initialization ##*/ 
  1456. add_action( 'init', 'gglplsn_init' ); 
  1457. add_action( 'plugins_loaded', 'gglplsn_plugins_loaded' ); 
  1458. add_action( 'admin_init', 'gglplsn_admin_init' ); 
  1459.  
  1460. /** Adding stylesheets */ 
  1461. add_action( 'wp_footer', 'gglplsn_footer_actions' ); 
  1462. add_action( 'admin_enqueue_scripts', 'gglplsn_admin_head' ); 
  1463.  
  1464. add_filter( 'pgntn_callback', 'gglplsn_pagination_callback' ); 
  1465.  
  1466. /** Adding plugin buttons */ 
  1467. add_shortcode( 'bws_googleplusone', 'gglplsn_shortcode' ); 
  1468. add_filter( 'widget_text', 'do_shortcode' ); 
  1469. add_filter( 'the_content', 'gglplsn_pos' ); 
  1470. /** Register widget */ 
  1471. add_action( 'widgets_init', 'gglplsn_register_badge_widget' ); 
  1472. /** custom filter for bws button in tinyMCE */ 
  1473. add_filter( 'bws_shortcode_button_content', 'gglplsn_shortcode_button_content' ); 
  1474. /** action for AJAX */ 
  1475. add_action( 'wp_ajax_gglplsn_validate_email', 'gglplsn_validate_email' ); 
  1476. /**## Additional links on the plugin page */ 
  1477. add_filter( 'plugin_action_links', 'gglplsn_action_links', 10, 2 ); 
  1478. add_filter( 'plugin_row_meta', 'gglplsn_register_plugin_links', 10, 2 ); 
  1479. /** Adding banner */ 
  1480. add_action( 'admin_notices', 'gglplsn_plugin_banner' ); 
  1481. /** Plugin uninstall function */ 
.