BPActivityPrivacy_Admin

Loads Buddypress Activity privacy plugin admin area.

Defined (1)

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

/includes/bp-activity-privacy-admin.php  
  1. class BPActivityPrivacy_Admin { 
  2.  
  3. var $setting_page = ''; 
  4.  
  5. function __construct() { 
  6. $this->setup_actions(); 
  7.  
  8.  
  9. function setup_actions() { 
  10. add_action( bp_core_admin_hook(), array( &$this, 'admin_menu' ) ); 
  11. //Welcome page redirect 
  12. add_action( 'admin_init', array( &$this, 'do_activation_redirect' ), 1 ); 
  13. // Catch save submits 
  14. add_action( 'admin_init', array( &$this, 'admin_submit' ) ); 
  15.  
  16.  
  17. // Modify Buddypress Activity Privacy admin links 
  18. add_filter( 'plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 ); 
  19. add_filter( 'network_admin_plugin_action_links', array( $this, 'modify_plugin_action_links' ), 10, 2 ); 
  20.  
  21.  
  22. function admin_menu() { 
  23. $welcome_page = add_dashboard_page( 
  24. __( 'Welcome to Buddypress Activity Privacy', 'bp-activity-privacy' ),  
  25. __( 'Welcome to BP Activity Privacy', 'bp-activity-privacy' ),  
  26. 'manage_options',  
  27. 'bp-activity-privacy-about',  
  28. array( $this, 'about_screen' ) 
  29. ); 
  30.  
  31. $this->settings_page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php'; 
  32. $hook = add_submenu_page( $this->settings_page, __( 'BuddyPress Activity Privacy', 'bp-activity-privacy' ), __( 'BP Activity Privacy', 'bp-activity-privacy' ), 'manage_options', 'bp-activity-privacy', array( &$this, 'admin_page' ) ); 
  33.  
  34. //add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 
  35. add_action( "admin_print_scripts-$hook", array( &$this, 'enqueue_scripts' ) ); 
  36. add_action( "admin_print_styles-$hook", array( &$this, 'enqueue_styles' ) ); 
  37.  
  38. remove_submenu_page( 'index.php', 'bp-activity-privacy-about' ); 
  39.  
  40.  
  41. /** 
  42. * Modifies the links in plugins table 
  43. *  
  44. */ 
  45. public function modify_plugin_action_links( $links, $file ) { 
  46.  
  47. // Return normal links if not BuddyPress 
  48. if ( plugin_basename( BP_ACTIVITY_PRIVACY_PLUGIN_FILE_LOADER ) != $file ) 
  49. return $links; 
  50.  
  51. // Add a few links to the existing links array 
  52. return array_merge( $links, array( 
  53. 'settings' => '<a href="' . add_query_arg( array( 'page' => 'bp-activity-privacy' ), bp_get_admin_url( $this->settings_page ) ) . '">' . esc_html__( 'Settings', 'bp-activity-privacy' ) . '</a>',  
  54. 'about' => '<a href="' . add_query_arg( array( 'page' => 'bp-activity-privacy-about' ), bp_get_admin_url( 'index.php' ) ) . '">' . esc_html__( 'About', 'bp-activity-privacy' ) . '</a>' 
  55. ) ); 
  56.  
  57. function admin_submit() { 
  58. if ( isset( $_POST['bpap-submit'] ) || isset( $_POST['bpap-reset'] ) ) { 
  59. if ( !is_super_admin() ) { 
  60. return; 
  61.  
  62. check_admin_referer( 'bpap-settings' ); 
  63.  
  64. if( isset( $_POST['bpap-submit'] ) ) { 
  65. // settings  
  66. $allow_admin_ve_privacy_levels = ( @$_POST['allow-admin-view-edit-privacy-levels'] ) ? true : false; 
  67. bp_update_option( 'bp_ap_allow_admin_ve_pl', $allow_admin_ve_privacy_levels ); 
  68.  
  69. $allow_members_e_privacy_levels = ( @$_POST['allow-members-edit-privacy-levels'] ) ? true : false; 
  70. bp_update_option( 'bp_ap_allow_members_e_pl', $allow_members_e_privacy_levels ); 
  71.  
  72. $use_fontawsome = ( $_POST['use-fontawsome'] ) ? true : false; 
  73. bp_update_option( 'bp_ap_use_fontawsome', $use_fontawsome ); 
  74.  
  75. $use_custom_styled_selectbox = ( @$_POST['use-custom-styled-selectbox'] ) ? true : false; 
  76. bp_update_option( 'bp_ap_use_custom_styled_selectbox', $use_custom_styled_selectbox ); 
  77.  
  78. $show_privacy_levels_label = ( @$_POST['show-privacy-levels-label'] ) ? true : false; 
  79. bp_update_option( 'bp_ap_show_privacy_ll', $show_privacy_levels_label ); 
  80.  
  81. $show_privacy_in_activity_meta = ( @$_POST['show-privacy-in-activity-meta'] ) ? true : false; 
  82. bp_update_option( 'bp_ap_show_privacy_in_am', $show_privacy_in_activity_meta); 
  83.  
  84. $pavl = $_POST['pavl']; 
  85. $pavl_enabled = $_POST['pavl_enabled']; 
  86. $pavl_default = $_POST['pavl_default']; 
  87.  
  88. // Register the visibility levels 
  89. $profile_activity_visibility_levels = array( 
  90. 'public' => array( 
  91. 'id' => 'public',  
  92. 'label' => __( 'Anyone', 'bp-activity-privacy' ),  
  93. 'default' => ( $pavl_default == 'public' ) ? true : false,  
  94. 'position' => 10*( 1 + array_search('public', array_keys($pavl))),  
  95. 'disabled' => ( $pavl_enabled ['public'] ) ? false : true 
  96. ),  
  97. 'loggedin' => array( 
  98. 'id' => 'loggedin',  
  99. 'label' => __( 'Logged In Users', 'bp-activity-privacy' ),  
  100. 'default' => ( $pavl_default == 'loggedin') ? true : false,  
  101. 'position' => 10*( 1 + array_search('loggedin', array_keys($pavl))),  
  102. 'disabled' => ( $pavl_enabled ['loggedin'] ) ? false : true 
  103. ); 
  104.  
  105. if ( bp_is_active( 'friends' ) ) { 
  106. $profile_activity_visibility_levels['friends'] = array( 
  107. 'id' => 'friends',  
  108. 'label' => __( 'My Friends', 'bp-activity-privacy' ),  
  109. 'default' => ( $pavl_default == 'friends') ? true : false,  
  110. 'position' => 10*( 1 + array_search('friends', array_keys($pavl))),  
  111. 'disabled' => ( $pavl_enabled ['friends'] ) ? false : true 
  112. ); 
  113.  
  114. // https://buddypress.trac.wordpress.org/changeset/7193 
  115. if ( function_exists('bp_activity_do_mentions') ) { 
  116. if ( bp_activity_do_mentions() ) { 
  117. $profile_activity_visibility_levels['mentionedonly'] = array( 
  118. 'id' => 'mentionedonly',  
  119. 'label' => __( 'Mentioned Only', 'bp-activity-privacy' ),  
  120. 'default' => ( $pavl_default == 'mentionedonly') ? true : false,  
  121. 'position' => 10*( 1 + array_search('mentionedonly', array_keys($pavl))),  
  122. 'disabled' => ( $pavl_enabled ['mentionedonly'] ) ? false : true 
  123. ); 
  124.  
  125. } else { 
  126. /** 
  127. $profile_activity_visibility_levels['mentionedonly'] = array( 
  128. 'id' => 'mentionedonly',  
  129. 'label' => __( 'Mentioned Only', 'bp-activity-privacy' ),  
  130. 'default' => ( $pavl_default == 'mentionedonly') ? true : false,  
  131. 'position' => 10*( 1 + array_search('mentionedonly', array_keys($pavl))),  
  132. 'disabled' => ( $pavl_enabled ['mentionedonly'] ) ? false : true 
  133. ); */  
  134.  
  135. $profile_activity_visibility_levels['adminsonly'] = array( 
  136. 'id' => 'adminsonly',  
  137. 'label' => __( 'Admins Only', 'bp-activity-privacy' ),  
  138. 'default' => ( $pavl_default == 'adminsonly') ? true : false,  
  139. 'position' => 10*( 1 + array_search('adminsonly', array_keys($pavl))),  
  140. 'disabled' => ( $pavl_enabled ['adminsonly'] ) ? false : true 
  141. ); 
  142.  
  143. $profile_activity_visibility_levels['onlyme'] = array( 
  144. 'id' => 'onlyme',  
  145. 'label' => __( 'Only Me', 'bp-activity-privacy' ),  
  146. 'default' => ( $pavl_default == 'onlyme') ? true : false,  
  147. 'position' => 10*( 1 + array_search('onlyme', array_keys($pavl))),  
  148. 'disabled' => ( $pavl_enabled ['onlyme'] ) ? false : true 
  149. );  
  150.  
  151. //followers plugin integration 
  152. if( function_exists('bp_follow_is_following') ) { 
  153. $profile_activity_visibility_levels['followers'] = array( 
  154. 'id' => 'followers',  
  155. 'label' => __( 'My Followers', 'bp-activity-privacy' ),  
  156. 'default' => ( $pavl_default == 'followers') ? true : false,  
  157. 'position' => 10*( 1 + array_search('followers', array_keys($pavl))),  
  158. 'disabled' => ( $pavl_enabled ['followers'] ) ? false : true 
  159. ); 
  160.  
  161. bp_update_option( 'bp_ap_profile_activity_visibility_levels', $profile_activity_visibility_levels ); 
  162.  
  163. //Groups activity privacy 
  164.  
  165. $gavl = $_POST['gavl']; 
  166. $gavl_enabled = $_POST['gavl_enabled']; 
  167. $gavl_default = $_POST['gavl_default']; 
  168.  
  169. $groups_activity_visibility_levels = array( 
  170. 'public' => array( 
  171. 'id' => 'public',  
  172. 'label' => __( 'Anyone', 'bp-activity-privacy' ),  
  173. 'default' => ( $gavl_default == 'public') ? true : false,  
  174. 'position' => 10*( 1 + array_search('public', array_keys($gavl))),  
  175. 'disabled' => ( $gavl_enabled ['public'] ) ? false : true  
  176. ),  
  177. 'loggedin' => array( 
  178. 'id' => 'loggedin',  
  179. 'label' => __( 'Logged In Users', 'bp-activity-privacy' ),  
  180. 'default' => ( $gavl_default == 'loggedin') ? true : false,  
  181. 'position' => 10*( 1 + array_search('loggedin', array_keys($gavl))),  
  182. 'disabled' => ( $gavl_enabled ['loggedin'] ) ? false : true  
  183. ); 
  184.  
  185. if ( bp_is_active( 'friends' ) ) { 
  186. $groups_activity_visibility_levels['friends'] = array( 
  187. 'id' => 'friends',  
  188. 'label' => __( 'My Friends', 'bp-activity-privacy' ),  
  189. 'default' => ( $gavl_default == 'friends') ? true : false,  
  190. 'position' => 10*( 1 + array_search('friends', array_keys($gavl))),  
  191. 'disabled' => ( $gavl_enabled ['friends'] ) ? false : true  
  192. ); 
  193. if ( bp_is_active( 'groups' ) ) { 
  194. $groups_activity_visibility_levels['groupfriends'] = array( 
  195. 'id' => 'groupfriends',  
  196. 'label' => __( 'My Friends in Group', 'bp-activity-privacy' ),  
  197. 'default' => ( $gavl_default == 'groupfriends') ? true : false,  
  198. 'position' => 10*( 1 + array_search('groupfriends', array_keys($gavl))),  
  199. 'disabled' => ( $gavl_enabled ['groupfriends'] ) ? false : true  
  200. ); 
  201.  
  202. if ( bp_activity_do_mentions() ) { 
  203. $groups_activity_visibility_levels['mentionedonly'] = array( 
  204. 'id' => 'mentionedonly',  
  205. 'label' => __( 'Mentioned Only', 'bp-activity-privacy' ),  
  206. 'default' => ( $gavl_default == 'mentionedonly') ? true : false,  
  207. 'position' => 10*( 1 + array_search('mentionedonly', array_keys($gavl))),  
  208. 'disabled' => ( $gavl_enabled ['mentionedonly'] ) ? false : true  
  209. ); 
  210.  
  211. if ( bp_is_active( 'groups' ) ) { 
  212. $groups_activity_visibility_levels['grouponly'] = array( 
  213. 'id' => 'grouponly',  
  214. 'label' => __( 'Group Members', 'bp-activity-privacy' ),  
  215. 'default' => ( $gavl_default == 'grouponly') ? true : false,  
  216. 'position' => 10*( 1 + array_search('grouponly', array_keys($gavl))),  
  217. 'disabled' => ( $gavl_enabled ['grouponly'] ) ? false : true  
  218. ); 
  219.  
  220. $groups_activity_visibility_levels['groupmoderators'] = array( 
  221. 'id' => 'groupmoderators',  
  222. 'label' => __( 'Group Moderators', 'bp-activity-privacy' ),  
  223. 'default' => ( $gavl_default == 'groupmoderators') ? true : false,  
  224. 'position' => 10*( 1 + array_search('groupmoderators', array_keys($gavl))),  
  225. 'disabled' => ( $gavl_enabled ['groupmoderators'] ) ? false : true  
  226. ); 
  227.  
  228. $groups_activity_visibility_levels['groupadmins'] = array( 
  229. 'id' => 'groupadmins',  
  230. 'label' => __( 'Group Admins', 'bp-activity-privacy' ),  
  231. 'default' => ( $gavl_default == 'groupadmins') ? true : false,  
  232. 'position' => 10*( 1 + array_search('groupadmins', array_keys($gavl))),  
  233. 'disabled' => ( $gavl_enabled ['groupadmins'] ) ? false : true  
  234. ); 
  235. }  
  236.  
  237. $groups_activity_visibility_levels['adminsonly'] = array( 
  238. 'id' => 'adminsonly',  
  239. 'label' => __( 'Admins Only', 'bp-activity-privacy' ),  
  240. 'default' => ( $gavl_default == 'adminsonly') ? true : false,  
  241. 'position' => 10*( 1 + array_search('adminsonly', array_keys($gavl))),  
  242. 'disabled' => ( $gavl_enabled ['adminsonly'] ) ? false : true  
  243. ); 
  244.  
  245. $groups_activity_visibility_levels['onlyme'] = array( 
  246. 'id' => 'onlyme',  
  247. 'label' => __( 'Only Me', 'bp-activity-privacy' ),  
  248. 'default' => ( $gavl_default == 'onlyme') ? true : false,  
  249. 'position' => 10*( 1 + array_search('onlyme', array_keys($gavl))),  
  250. 'disabled' => ( $gavl_enabled ['onlyme'] ) ? false : true  
  251. );  
  252.  
  253. //followers plugin integration 
  254. if( function_exists('bp_follow_is_following') ) { 
  255. $groups_activity_visibility_levels['followers'] = array( 
  256. 'id' => 'followers',  
  257. 'label' => __( 'My Followers', 'bp-activity-privacy' ),  
  258. 'default' => ( $gavl_default == 'followers') ? true : false,  
  259. 'position' => 10*( 1 + array_search('followers', array_keys($gavl))),  
  260. 'disabled' => ( $gavl_enabled ['followers'] ) ? false : true  
  261. );  
  262. $groups_activity_visibility_levels['groupfollowers'] = array( 
  263. 'id' => 'groupfollowers',  
  264. 'label' => __( 'My Followers in Group', 'bp-activity-privacy' ),  
  265. 'default' => ( $gavl_default == 'groupfollowers') ? true : false,  
  266. 'position' => 10*( 1 + array_search('groupfollowers', array_keys($gavl))),  
  267. 'disabled' => ( $gavl_enabled ['groupfollowers'] ) ? false : true  
  268. );  
  269.  
  270. bp_update_option( 'bp_ap_groups_activity_visibility_levels', $groups_activity_visibility_levels ); 
  271. ?> 
  272. <div id="message" class="updated"><p><?php _e( 'Settings saved.', 'bp-activity-privacy' );?></p></div> 
  273. <?php 
  274.  
  275. } else { 
  276. global $bp_activity_privacy; 
  277.  
  278. bp_update_option( 'bp_ap_profile_activity_visibility_levels', $bp_activity_privacy->profile_activity_visibility_levels ); 
  279. bp_update_option( 'bp_ap_groups_activity_visibility_levels', $bp_activity_privacy->groups_activity_visibility_levels ); 
  280.  
  281. bp_update_option( 'bp_ap_allow_admin_ve_pl', false ); 
  282. bp_update_option( 'bp_ap_allow_members_e_pl', true ); 
  283. bp_update_option( 'bp_ap_use_fontawsome', true ); 
  284. bp_update_option( 'bp_ap_use_custom_styled_selectbox', true ); 
  285. bp_update_option( 'bp_ap_show_privacy_ll', true ); 
  286. bp_update_option( 'bp_ap_show_privacy_in_am', true); 
  287. ?> 
  288. <div id="message" class="updated"><p><?php _e( 'Settings reseted.', 'bp-activity-privacy' );?></p></div> 
  289. <?php 
  290. }  
  291.  
  292. function admin_page() {  
  293. ?> 
  294. <div class="wrap"> 
  295. <?php screen_icon( 'buddypress' ); ?> 
  296. <h2><?php _e( 'BuddyPress Activity Privacy', 'bp-activity-privacy' ); ?> <sup>v <?php echo BP_ACTIVITY_PRIVACY_VERSION ?> </sup></h2> 
  297.  
  298. <form method="post" action=""> 
  299.  
  300. <h3><label><?php _e('Profil Activity privacy', 'bp-activity-privacy') ?></label></h3>  
  301. <div class="bpap-options-box options-box ui-sortable"> 
  302. <h4><?php _e('Please check the box to enable the privacy and Drag&Drop to sort :', 'bp-activity-privacy') ?></h4>  
  303. <?php  
  304. //$html = "<ul>"; 
  305. // 
  306. $html = ""; 
  307. $profile_activity_visibility_levels = bp_get_profile_activity_visibility_levels(); 
  308. uasort ($profile_activity_visibility_levels, 'bp_activity_privacy_cmp_position'); 
  309. foreach ($profile_activity_visibility_levels as $key => $pavl) { 
  310. $disabled = ( !$pavl["disabled"] ) ? 'checked' : ''; 
  311. $default = ( $pavl["default"] ) ? 'checked' : ''; 
  312.  
  313. $html .= ' <p class="sortable" style=""><span style="cursor: default;"> * </span><label for="' . $pavl["id"] .'"><input type="checkbox" name="pavl_enabled[' . $pavl["id"] .']" ' . $disabled .' />   ' . $pavl["label"] .'</label>'; 
  314. $html .= '<input type="hidden" name="pavl[' . $key .']" value="' . $pavl["id"] .'" /><input name="pavl_default" id="pavl_default" value="' . $key .'" type="radio" ' . $default . '><span style="cursor: move;">Default Value</span>'; 
  315. $html .= ' </p>'; 
  316.  
  317. // $html .= ' <li><label for="' . $pavl["id"] .'">Position: <input type="text" name="position[' . $pavl["id"] .']" value="' . $pavl["position"] .'" /></label></p>'; 
  318.  
  319. // $html .= "</ul>"; 
  320. echo $html; 
  321. ?>  
  322. </div> 
  323.  
  324. <h3><label><?php _e('Groups Activity privacy', 'bp-activity-privacy') ?></label></h3> 
  325. <div class="bpap-options-box options-box ui-sortable"> 
  326. <h4><?php _e('Please check the box to enable the privacy and Drag&Drop to sort :', 'bp-activity-privacy') ?></h4>  
  327. <?php  
  328. $groups_activity_visibility_levels = bp_get_groups_activity_visibility_levels(); 
  329. uasort ($groups_activity_visibility_levels, 'bp_activity_privacy_cmp_position');  
  330. $html = ''; 
  331. foreach ($groups_activity_visibility_levels as $key => $pavl) { 
  332. $disabled = ( !$pavl["disabled"] ) ? 'checked' : ''; 
  333. $default = ( $pavl["default"] ) ? 'checked' : ''; 
  334.  
  335. $html .= ' <p class="sortable" style=""><span style="cursor: default;"> * </span><label for="' . $pavl["id"] .'"><input type="checkbox" name="gavl_enabled[' . $pavl["id"] .']" ' . $disabled .' />   ' . $pavl["label"] .'</label>'; 
  336. $html .= '<input type="hidden" name="gavl[' . $key .']" value="' . $pavl["id"] .'" /><input name="gavl_default" id="gavl_default" value="' . $key .'" type="radio" ' . $default . '><span style="cursor: move;">Default Value</span>'; 
  337. $html .= ' </p>'; 
  338. echo $html; 
  339. ?>  
  340. </div> 
  341.  
  342. <?php 
  343. $allow_admin_ve_privacy_levels = bp_ap_is_admin_allowed_to_view_edit_privacy_levels(); 
  344. $allow_members_e_privacy_levels = bp_ap_is_members_allowed_to_edit_privacy_levels(); 
  345. $use_fontawsome = bp_ap_is_use_fontawsome(); 
  346. $use_custom_styled_selectbox = bp_ap_is_use_custom_styled_selectbox(); 
  347. $show_privacy_levels_label = bp_ap_show_privacy_levels_label(); 
  348. $show_privacy_in_activity_meta = bp_ap_show_privacy_in_activity_meta(); 
  349. ?> 
  350.  
  351. <h3><label><?php _e('Settings', 'bp-activity-privacy') ?></label></h3>  
  352. <h4><?php _e('Main settings', 'bp-activity-privacy') ?></h4>  
  353. <table class="form-table"> 
  354. <tbody><tr><th scope="row"><?php _e('Admin privileges', 'bp-activity-privacy') ?></th><td> 
  355. <input id="allow-admin-view-edit-privacy-levels" name="allow-admin-view-edit-privacy-levels" <?= ($allow_admin_ve_privacy_levels) ? 'checked' : ''; ?> type="checkbox" /> 
  356. <label for="allow-admin-view-edit-privacy-levels"><?php _e('Allow admin to view and edit the prviacy of all activities', 'bp-activity-privacy') ?></label> 
  357.  
  358. </td></tr><tr><th scope="row">Members privileges</th><td> 
  359. <input id="allow-members-edit-privacy-levels" name="allow-members-edit-privacy-levels" <?= ($allow_members_e_privacy_levels) ? 'checked' : ''; ?> type="checkbox" /> 
  360. <label for="allow-members-edit-privacy-levels"><?php _e('Allow members to edit the privacy of their activities', 'bp-activity-privacy') ?></label> 
  361.  
  362. </td></tr> 
  363. </tbody> 
  364. </table> 
  365. <h4><?php _e('UI settings', 'bp-activity-privacy') ?></h4> 
  366. <table class="form-table"> 
  367. <tbody> 
  368. <tr> 
  369. <th scope="row"><?php _e('Font Awesome Icons', 'bp-activity-privacy') ?></th> 
  370. <td> 
  371. <input id="use-fontawsome" name="use-fontawsome" <?= ($use_fontawsome) ? 'checked' : ''; ?> type="checkbox" /> 
  372. <label for="use-fontawsome"><?php _e('Use FontAwesome Icons', 'bp-activity-privacy') ?></label> 
  373. </td> 
  374. </tr> 
  375. <tr> 
  376. <th scope="row"><?php _e('Custom styled selectbox', 'bp-activity-privacy') ?></th> 
  377. <td> 
  378. <input id="use-custom-styled-selectbox" name="use-custom-styled-selectbox" <?= ($use_custom_styled_selectbox) ? 'checked' : ''; ?> type="checkbox" /> 
  379. <label for="use-custom-styled-selectbox"><?php _e('Use custom styled selectbox', 'bp-activity-privacy') ?></label> 
  380.  
  381. </td> 
  382. </tr> 
  383.  
  384. <tr> 
  385. <th scope="row"><?php _e('Privacy labels', 'bp-activity-privacy') ?></th> 
  386. <td> 
  387. <input id="show-privacy-levels-label" name="show-privacy-levels-label" <?= ($show_privacy_levels_label) ? 'checked' : ''; ?> type="checkbox"> 
  388. <label for="show-privacy-levels-label"><?php _e('Show the privacy label in selectbox (Use FontAwesome Icons should be checked if this is unchecked)', 'bp-activity-privacy') ?></label> 
  389. </td> 
  390. </tr> 
  391. <tr> 
  392. <th scope="row"><?php _e('Privacy in activity meta', 'bp-activity-privacy') ?></th> 
  393. <td> 
  394. <input id="show-privacy-in-activity-meta" name="show-privacy-in-activity-meta" <?= ($show_privacy_in_activity_meta) ? 'checked' : ''; ?> type="checkbox"> 
  395. <label for="show-privacy-in-activity-meta"><?php _e('Show the privacy in activity meta', 'bp-activity-privacy') ?></label> 
  396. </td> 
  397. </tr> 
  398. </tbody> 
  399. </table> 
  400.  
  401. <?php wp_nonce_field( 'bpap-settings' ) ?> 
  402. <br /> 
  403. <input type="submit" name="bpap-submit" class="button-primary" value="<?php _e( "Save Settings", 'bp-activity-privacy' ) ?>" /> 
  404. <input type="submit" name="bpap-reset" class="button-secondary" value="<?php _e( "Reset", 'bp-activity-privacy' ) ?>" /> 
  405. </form> 
  406. </div><!-- end-wrap -->  
  407. <?php  
  408.  
  409.  
  410. public function about_screen() { 
  411. $display_version = BP_ACTIVITY_PRIVACY_VERSION; 
  412. $settings_url = add_query_arg( array( 'page' => 'bp-activity-privacy'), bp_get_admin_url( $this->settings_page ) ); 
  413. ?> 
  414. <style type="text/css"> 
  415. /* Changelog / Update screen */ 
  416.  
  417. .about-wrap .feature-section img { 
  418. border: none; 
  419. margin: 0 1.94% 10px 0; 
  420. -webkit-border-radius: 3px; 
  421. border-radius: 3px; 
  422.  
  423. .about-wrap .feature-section.three-col img { 
  424. margin: 0.5em 0 0.5em 5px; 
  425. max-width: 100%; 
  426. float: none; 
  427.  
  428. .ie8 .about-wrap .feature-section.three-col img { 
  429. margin-left: 0; 
  430.  
  431. .about-wrap .feature-section.images-stagger-right img { 
  432. float: right; 
  433. margin: 0 5px 12px 2em; 
  434.  
  435. .about-wrap .feature-section.images-stagger-left img { 
  436. float: left; 
  437. margin: 0 2em 12px 5px; 
  438.  
  439. .about-wrap .feature-section img.image-100 { 
  440. margin: 0 0 2em 0; 
  441. width: 100%; 
  442.  
  443. .about-wrap .feature-section img.image-66 { 
  444. width: 65%; 
  445.  
  446. .about-wrap .feature-section img.image-50 { 
  447. max-width: 50%; 
  448.  
  449. .about-wrap .feature-section img.image-30 { 
  450. max-width: 31.2381%; 
  451.  
  452. .ie8 .about-wrap .feature-section img { 
  453. border-width: 1px; 
  454. border-style: solid; 
  455. }  
  456.  
  457. .about-wrap .images-stagger-right img.image-30:nth-child(2) { 
  458. margin-left: 1em; 
  459.  
  460. .about-wrap .feature-section img { 
  461. background: none repeat scroll 0% 0% #FFF; 
  462. border: 1px solid #CCC; 
  463. box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3); 
  464.  
  465. .bpap-admin-badge { 
  466. position: absolute; 
  467. top: 0px; 
  468. right: 0px; 
  469. padding-top: 190px; 
  470. height: 25px; 
  471. width: 173px; 
  472. color: #555; 
  473. font-weight: bold; 
  474. font-size: 11px; 
  475. text-align: center; 
  476. margin: 0px -5px; 
  477. background: url('<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL; ?>includes/images/badge.png') no-repeat scroll 0% 0% transparent; 
  478. </style> 
  479. <div class="wrap about-wrap"> 
  480. <h1><?php printf( __( 'Welcome to BuddyPress Activity Privacy %s', 'bp-activity-privacy' ), $display_version ); ?></h1> 
  481. <div class="about-text"><?php printf( __( 'Thank you for upgrading to the latest version of BP Activity Privacy! <br \> BP Activity Privacy %s is ready to manage the activity privacy of your Site!', 'bp-activity-privacy' ), $display_version ); ?></div> 
  482. <div class="bpap-admin-badge" style=""><?php printf( __( 'Version %s', 'bp-activity-privacy' ), $display_version ); ?></div> 
  483.  
  484. <div class="warning-text" style="color:red;font-weight:bold;text-align:center;"><?php _e( 'Please go to BP Acitivity Privacy Configuration and save your settings to apply new update.', 'bp-activity-privacy' ); ?></div> 
  485.  
  486. <h2 class="nav-tab-wrapper"> 
  487. <a class="nav-tab nav-tab-active" href="<?php echo esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-activity-privacy-about' ), 'index.php' ) ) ); ?>"> 
  488. <?php _e( 'About', 'bp-activity-privacy' ); ?> 
  489. </a> 
  490. </h2> 
  491.  
  492. <div class="changelog"> 
  493. <h3><?php _e( 'Add Privacy Controls To The BuddyPress Activity Stream!', 'bp-activity-privacy' ); ?></h3> 
  494.  
  495. <div class="feature-section"> 
  496. <p><?php _e( 'BP Activity Privacy is a BuddyPress plugin who gives users the ability to restrict who can see their activity posts. ', 'bp-activity-privacy' ); ?></p> 
  497. <p><?php _e( 'It gives each member multiple privacy options on activity posts and should encourage more confident participation on your social network.', 'bp-activity-privacy' );?></p> 
  498. </div> 
  499. </div> 
  500.  
  501. <div class="changelog"> 
  502. <h3><?php printf( __( 'What' new in %s ?', 'bp-activity-privacy' ), $display_version ); ?></h3> 
  503.  
  504. <div class="feature-section"> 
  505. <ul> 
  506. <li><?php _e( 'Allow admin to view and edit the prviacy of all activities (Check Admin privileges in plugin settings).', 'bp-activity-privacy' );?></li> 
  507. <li><?php _e( 'Admin now have a control to enable/disable the members to edit the privacy of their activities.', 'bp-activity-privacy' );?></li> 
  508. <li><?php _e( 'Admin now have a control to enable/disable the FontAwesome icon.', 'bp-activity-privacy' );?></li> 
  509. <li><?php _e( 'Admin now have a finer control to enable/disable FontAwesome icon.', 'bp-activity-privacy' );?></li> 
  510. <li><?php _e( 'Admin now have a control to enable/disable the custom styled selectbox.', 'bp-activity-privacy' );?></li> 
  511. <li><?php _e( 'Admin now have a control to show/hide printing the privacy of activities in their meta.', 'bp-activity-privacy' );?></li> 
  512.  
  513. <strong><?php _e( 'Updates before current version', 'bp-activity-privacy' ); ?></strong> 
  514. <br /> 
  515. <br />  
  516. <li class=""><?php _e( 'The plugin work now on Multisite Network!', 'bp-activity-privacy' ); ?></li> 
  517. <li><?php _e( 'A New privacy level (Mentioned only). When a member choose this privacy level, only mentioned members (and admin of course) can see the activity.', 'bp-activity-privacy' ); ?></li> 
  518. <li><?php _e( '<strong>Remark:</strong> <i>Members mentioned in activity can see it\'s content whatever the privacy level.</i>', 'bp-activity-privacy' ); ?></li> 
  519. <li><?php _e( 'New Dropdown system with a nice icons ( By <a target="_BLANK" href="http://fontawesome.io/">Font Awesome</a> ).', 'bp-activity-privacy' ); ?></li> 
  520. </ul> 
  521. </div> 
  522. </div> 
  523.  
  524. <div class="changelog"> 
  525. <h3><?php _e( 'How it\'s Work ?' , 'bp-activity-privacy' ); ?></h3> 
  526.  
  527. <div class="feature-section images-stagger-right"> 
  528. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-1.png" class="image-50" /> 
  529. <p><?php _e( 'Once installed and activated, BuddyPress Activity Privacy adds following privacy controls to the post update box for members:', 'bp-activity-privacy' ); ?></p> 
  530. <ul> 
  531. <li><?php _e( 'Anyone', 'bp-activity-privacy' ); ?></li> 
  532. <li><?php _e( 'Logged In Users', 'bp-activity-privacy' ); ?></li> 
  533. <li><?php _e( 'My Friends', 'bp-activity-privacy' ); ?></li> 
  534. <li><?php _e( 'Mentioned Only', 'bp-activity-privacy' ); ?></li> 
  535. <li><?php _e( 'Admin Only', 'bp-activity-privacy' ); ?></li> 
  536. <li><?php _e( 'Only Me', 'bp-activity-privacy' ); ?></li> 
  537. </ul> 
  538. <p><?php _e( 'Certain privacy controls are component-dependent. For example, the "Friends Only" privacy option in the dropdown will not show up unless you have the Friends component activated in the BuddyPress settings panel.', 'bp-activity-privacy' ); ?></p> 
  539.  
  540. </div> 
  541. </div> 
  542.  
  543. <div class="changelog"> 
  544.  
  545. <div class="feature-section images-stagger-right"> 
  546. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-2.png" class="image-50" /> 
  547. <p> 
  548. <?php _e( 'When posting within a group the group-specific privacy options will be added to the dropdown, inlcluding:', 'bp-activity-privacy' ); ?>  
  549. <ul> 
  550. <li><?php _e( 'My Friends in a Group', 'bp-activity-privacy' ); ?></li> 
  551. <li><?php _e( 'Group Members', 'bp-activity-privacy' ); ?></li> 
  552. <li><?php _e( 'Group Moderators', 'bp-activity-privacy' ); ?></li> 
  553. <li><?php _e( 'Group Admins', 'bp-activity-privacy' ); ?></li> 
  554. </ul> 
  555. </div> 
  556. </div> 
  557.  
  558.  
  559. <div class="changelog"> 
  560. <h3><?php _e( 'Update the Privacy of the ol ', 'bp-activity-privacy' ); ?></h3> 
  561.  
  562. <div class="feature-section images-stagger-right"> 
  563. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-6.png" class="image-50" /> 
  564. <p><?php _e( 'Members can update the privacy of the old activity stream (new selectbox in activity meta).', 'bp-activity-privacy' ); ?></p> 
  565. <p><?php _e( 'Admin can also update the privacy of all the old activity stream.', 'bp-activity-privacy' ); ?></p> 
  566. </div> 
  567. </div> 
  568.  
  569. <div class="changelog"> 
  570. <h3><?php _e( 'Privacy control for Followers Plugin', 'bp-activity-privacy' ); ?></h3> 
  571.  
  572. <div class="feature-section images-stagger-right"> 
  573. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-3.png" class="image-50" /> 
  574. <h4><?php _e( 'Fully integrated with Buddypress Follow', 'bp-activity-privacy' ); ?></h4> 
  575. <p><?php _e( 'If you have <a href="http://wordpress.org/plugins/buddypress-followers/">BuddyPress Follow</a> installed in your site, BP Activity Privacy adds new privacy levels :', 'bp-activity-privacy' ); ?></p> 
  576. <ul> 
  577. <li><?php _e( 'My Followers', 'bp-activity-privacy' ); ?></li> 
  578. <li><?php _e( 'My followers in Group', 'bp-activity-privacy' ); ?></li> 
  579. </ul> 
  580. </div> 
  581. </div> 
  582.  
  583. <div class="changelog"> 
  584. <h3><?php _e( 'Integration for Buddypress Activity Plus Plugin', 'bp-activity-privacy' ); ?></h3> 
  585.  
  586. <div class="feature-section images-stagger-right"> 
  587. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-5.png" class="image-50" /> 
  588. <p><?php _e( 'BP Activity Privacy is released with Integration for <a href="http://wordpress.org/plugins/buddypress-activity-plus/">Buddypress Activity Plus</a>.', 'bp-activity-privacy' ); ?></p> 
  589. </div> 
  590. </div>  
  591.  
  592. <div class="changelog"> 
  593. <h3><?php _e( 'BP Acitivity Privacy Configuration', 'bp-activity-privacy' ); ?></h3> 
  594.  
  595. <div class="feature-section images-stagger-right"> 
  596. <img alt="" src="<?php echo BP_ACTIVITY_PRIVACY_PLUGIN_URL;?>/screenshot-7.png" class="image-50" /> 
  597. <h4><a href="<?php echo $settings_url;?>" title="<?php _e( 'Configure BP Activity Privacy', 'bp-activity-privacy' ); ?>"><?php _e( 'Configure BP Activity Privacy', 'bp-activity-privacy' ); ?></a></h4> 
  598. <p><?php _e( 'From the settings menu of his WordPress administration, the administrator is able to configure BP Activity Privacy by :', 'bp-activity-privacy' ); ?></p> 
  599. <ul> 
  600. <li><?php _e( 'Enable/Disable a privacy level.', 'bp-activity-privacy' ); ?></li> 
  601. <li><?php _e( 'Sort the privacy levels.', 'bp-activity-privacy' ); ?></li> 
  602. <li><?php _e( 'Change the default privacy level.', 'bp-activity-privacy' ); ?></li> 
  603. </ul> 
  604. </div> 
  605.  
  606. <div class="return-to-dashboard"> 
  607. <a href="<?php echo $settings_url;?>" title="<?php _e( 'Configure BP Activity Privacy', 'bp-activity-privacy' ); ?>"><?php _e( 'Go to the BP Activity Privacy Settings page', 'bp-activity-privacy' );?></a> 
  608. </div> 
  609. </div> 
  610.  
  611. </div> 
  612. <?php 
  613.  
  614. /** 
  615. * Welcome screen redirect 
  616. */ 
  617. function do_activation_redirect() { 
  618. // Bail if no activation redirect 
  619. if ( ! get_transient( '_bp_activity_privacy_activation_redirect' ) ) 
  620. return; 
  621.  
  622. // Delete the redirect transient 
  623. delete_transient( '_bp_activity_privacy_activation_redirect' ); 
  624.  
  625. // Bail if activating from network, or bulk 
  626. if ( isset( $_GET['activate-multi'] ) ) 
  627. return; 
  628.  
  629. $query_args = array( 'page' => 'bp-activity-privacy-about' ); 
  630.  
  631. // Redirect to Buddypress Activity privacy about page 
  632. wp_safe_redirect( add_query_arg( $query_args, bp_get_admin_url( 'index.php' ) ) ); 
  633. }  
  634.  
  635. function enqueue_scripts() { 
  636. wp_enqueue_script( 'bpap-admin-js', plugins_url( 'js/admin.js' , __FILE__ ), array( 'jquery', 'jquery-ui-sortable' ) ); 
  637.  
  638.  
  639. function enqueue_styles() { 
  640. if(bp_ap_is_use_fontawsome()) { 
  641. wp_enqueue_style( 'bp-font-awesome-css', plugins_url( 'css/font-awesome/css/font-awesome.min.css' , __FILE__ ));  
  642. wp_enqueue_style( 'bp-activity-privacy-admin-css', plugins_url( 'css/admin.css' , __FILE__ ));  
  643.  
  644. //@TODO 
  645. function update() {