get_results("SELECT option_name,option_value FROM {$wpdb->prefix}atb_options;",OBJECT); if($get_config){ foreach($get_config as $row): if($row->option_name=='disable_visual_editor') $disable_visual_editor=$row->option_value; if($row->option_name=='disable_visual_editor_role') $disable_visual_editor_role=explode(",",$row->option_value); if($row->option_name=='disable_visual_editor_role_exclude') $disable_visual_editor_role_exclude=$row->option_value; if($row->option_name=='disable_visual_editor_post') $disable_visual_editor_post=explode(",",$row->option_value); if($row->option_name=='disable_visual_editor_post_exclude') $disable_visual_editor_post_exclude=$row->option_value; if($row->option_name=='hide_new_btn') $hide_new_btn=$row->option_value; if($row->option_name=='hide_new_btn_role') $hide_new_btn_role=explode(",",$row->option_value); if($row->option_name=='hide_new_btn_role_exclude') $hide_new_btn_role_exclude=$row->option_value; if($row->option_name=='hide_new_btn_post') $hide_new_btn_post=explode(",",$row->option_value); if($row->option_name=='hide_new_btn_post_exclude') $hide_new_btn_post_exclude=$row->option_value; if($row->option_name=='hide_bulk_action') $hide_bulk_action=$row->option_value; if($row->option_name=='hide_bulk_action_role') $hide_bulk_action_role=explode(",",$row->option_value); if($row->option_name=='hide_bulk_action_role_exclude') $hide_bulk_action_role_exclude=$row->option_value; if($row->option_name=='hide_bulk_action_post') $hide_bulk_action_post=explode(",",$row->option_value); if($row->option_name=='hide_bulk_action_post_exclude') $hide_bulk_action_post_exclude=$row->option_value; if($row->option_name=='disable_heartbeat') $disable_heartbeat=$row->option_value; if($row->option_name=='disable_heartbeat_pagetype') $disable_heartbeat_pagetype=explode(",",$row->option_value); if($row->option_name=='disable_heartbeat_pagetype_exclude') $disable_heartbeat_pagetype_exclude=$row->option_value; if($row->option_name=='disable_heartbeat_post') $disable_heartbeat_post=explode(",",$row->option_value); if($row->option_name=='disable_heartbeat_post_exclude') $disable_heartbeat_post_exclude=$row->option_value; if($row->option_name=='limit_revisions') $limit_revisions=$row->option_value; if($row->option_name=='limit_revisions_count') {$limit_revisions_count=$row->option_value; $_SESSION["limit_revisions_count"]=$limit_revisions_count;} if($row->option_name=='limit_revisions_post') $limit_revisions_post=explode(",",$row->option_value); if($row->option_name=='limit_revisions_post_exclude') $limit_revisions_post_exclude=$row->option_value; if($row->option_name=='limit_usereditor_role') $limit_usereditor_role=$row->option_value; if($row->option_name=='limit_usereditor_role_role') $limit_usereditor_role_role=explode(",",$row->option_value); if($row->option_name=='limit_usereditor_role_role_exclude') $limit_usereditor_role_role_exclude=$row->option_value; if($row->option_name=='limit_usereditor_hiderole_role') {$limit_usereditor_hiderole_role=$row->option_value; $_SESSION["limit_usereditor_hiderole_role"]=$limit_usereditor_hiderole_role;} if($row->option_name=='password_reset_link') $password_reset_link=$row->option_value; if($row->option_name=='password_reset_link_role') $password_reset_link_role=explode(",",$row->option_value); if($row->option_name=='password_reset_link_role_exclude') $password_reset_link_role_exclude=$row->option_value; if($row->option_name=='disable_notices') $disable_notices=$row->option_value; if($row->option_name=='disable_notices_role') $disable_notices_role=explode(",",$row->option_value); if($row->option_name=='disable_notices_role_exclude') $disable_notices_role_exclude=$row->option_value; if($row->option_name=='page_hit') $page_hit=$row->option_value; if($row->option_name=='page_hit_role') $page_hit_role=explode(",",$row->option_value); if($row->option_name=='page_hit_role_exclude') $page_hit_role_exclude=$row->option_value; if($row->option_name=='editor_warning') $editor_warning=$row->option_value; if($row->option_name=='editor_warning_role') $editor_warning_role=explode(",",$row->option_value); if($row->option_name=='editor_warning_role_exclude') $editor_warning_role_exclude=$row->option_value; if($row->option_name=='dual_auth') $dual_auth=$row->option_value; if($row->option_name=='dual_auth_role') $dual_auth_role=explode(",",$row->option_value); if($row->option_name=='dual_auth_role_exclude') $dual_auth_role_exclude=$row->option_value; if($row->option_name=='dual_auth_ip_exclude') $dual_auth_ip_exclude=$row->option_value; if($row->option_name=='disable_wpautop') $disable_wpautop=$row->option_value; if($row->option_name=='disable_wpautop_post') $disable_wpautop_post=explode(",",$row->option_value); if($row->option_name=='disable_wpautop_post_exclude') $disable_wpautop_post_exclude=$row->option_value; endforeach; // Get Post Type $post_type=''; if(!empty($_GET['post'])) { $post=get_post(intval($_GET['post'])); $post_type=$post->post_type; } if(empty($post_type) && !empty($_GET['post_type'])) $post_type=sanitize_text_field($_GET['post_type']); // Capture Page Hits if($page_hit==1) { if(($page_hit_role_exclude==0 && (count(array_intersect($page_hit_role,$user_roles))>0 || in_array('*All',$page_hit_role,true))) || ($page_hit_role_exclude==1 && count(array_intersect($page_hit_role,$user_roles))==0 && !in_array('*All',$page_hit_role,true))) { atb_hit_page(); } } // Disable TinyMCE Visual Editor if((atb_is_path('wp-admin/post.php?post=,wp-admin/post-new.php')) && $disable_visual_editor==1) { if(($disable_visual_editor_role_exclude==0 && (count(array_intersect($disable_visual_editor_role,$user_roles))>0 || in_array('*All',$disable_visual_editor_role,true))) || ($disable_visual_editor_role_exclude==1 && count(array_intersect($disable_visual_editor_role,$user_roles))==0 && !in_array('*All',$disable_visual_editor_role,true))) { if(strlen($post_type)>0 && (($disable_visual_editor_post_exclude==0 && (in_array($post_type,$disable_visual_editor_post,true) || in_array('*All',$disable_visual_editor_post,true))) || ($disable_visual_editor_post_exclude==1 && !in_array($post_type,$disable_visual_editor_post,true) && !in_array('*All',$disable_visual_editor_post,true)))) { add_filter('user_can_richedit','__return_false'); } } } // Hide New Post Buttons if($hide_new_btn==1) { if(($hide_new_btn_role_exclude==0 && (count(array_intersect($hide_new_btn_role,$user_roles))>0 || in_array('*All',$hide_new_btn_role,true))) || ($hide_new_btn_role_exclude==1 && count(array_intersect($hide_new_btn_role,$user_roles))==0 && !in_array('*All',$hide_new_btn_role,true))) { function atb_custom_hide_js() { ?> 0 || in_array('*All',$hide_bulk_action_role,true))) || ($hide_bulk_action_role_exclude==1 && count(array_intersect($hide_bulk_action_role,$user_roles))==0 && !in_array('*All',$hide_bulk_action_role,true))) { if(strlen($post_type)>0 && (($hide_bulk_action_post_exclude==0 && (in_array($post_type,$hide_bulk_action_post,true) || in_array('*All',$hide_bulk_action_post,true))) || ($hide_bulk_action_post_exclude==1 && !in_array($post_type,$hide_bulk_action_post,true) && !in_array('*All',$hide_bulk_action_post,true)))) { function atb_custom_remove_bulk() { ?> 0 || in_array('*All',$limit_usereditor_role_role,true))) || ($limit_usereditor_role_role_exclude==1 && count(array_intersect($limit_usereditor_role_role,$user_roles))==0 && !in_array('*All',$limit_usereditor_role_role,true))) { function atb_user() { ?> 0 || in_array('*All',$limit_usereditor_role_role,true))) || ($limit_usereditor_role_role_exclude==1 && count(array_intersect($limit_usereditor_role_role,$user_roles))==0 && !in_array('*All',$limit_usereditor_role_role,true))) { function atb_user_list() { ?> 0 || in_array('*All',$password_reset_link_role,true))) || ($password_reset_link_role_exclude==1 && count(array_intersect($password_reset_link_role,$user_roles))==0 && !in_array('*All',$password_reset_link_role,true))) { if(atb_is_path('wp-admin/user-edit.php')) { function atb_user_reset() { ?> 0 || in_array('*All',$disable_notices_role,true))) || ($disable_notices_role_exclude==1 && count(array_intersect($disable_notices_role,$user_roles))==0 && !in_array('*All',$disable_notices_role,true))) { function remove_core_updates(){global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);} add_filter('pre_site_transient_update_core','remove_core_updates'); add_filter('pre_site_transient_update_plugins','remove_core_updates'); add_filter('pre_site_transient_update_themes','remove_core_updates'); function atb_notices() { ?>alert('no_update_notification');"; } } // Deregister Heartbeat on Admin pages if($disable_heartbeat==1) { if(($disable_heartbeat_pagetype_exclude==0 && (in_array('Admin',$disable_heartbeat_pagetype,true) || in_array('*All',$disable_heartbeat_pagetype,true))) // Target Role OR All || ($disable_heartbeat_pagetype_exclude==1 && (!in_array('Admin',$disable_heartbeat_pagetype,true) || in_array('*All',$disable_heartbeat_pagetype,true)))) { // Stop if match to Role OR All if(strlen($post_type)==0 || ($disable_heartbeat_post_exclude==0 && (in_array($post_type,$disable_heartbeat_post,true) || in_array('*All',$disable_heartbeat_post,true))) // Target Post OR All || ($disable_heartbeat_post_exclude==1 && (!in_array($post_type,$disable_heartbeat_post,true) && !in_array('*All',$disable_heartbeat_post,true)))) { // Stop if match to Post OR All function atb_deregister_heartbeat_admin() {wp_deregister_script('heartbeat');} atb_deregister_heartbeat_admin(); //echo ""; } } } // Limit Post Revisions if(atb_is_path('wp-admin/post.php?post=') && $limit_revisions==1) { if(strlen($post_type)>0 && (($limit_revisions_post_exclude==0 && (in_array($post_type,$limit_revisions_post,true) || in_array('*All',$limit_revisions_post,true))) || ($limit_revisions_post_exclude==1 && !in_array($post_type,$limit_revisions_post,true) &&!in_array('*All',$limit_revisions_post,true)))) { //echo ""; function atb_post_revisions($num,$post) {return $_SESSION["limit_revisions_count"];} add_filter('wp_revisions_to_keep','atb_post_revisions',10,2); } } // Disable WPautop if($disable_wpautop==1) { if(strlen($post_type)>0 && (($disable_wpautop_post_exclude==0 && (in_array($post_type,$disable_wpautop_post,true) || in_array('*All',$disable_wpautop_post,true))) || ($disable_wpautop_post_exclude==1 && !in_array($post_type,$disable_wpautop_post,true) && !in_array('*All',$disable_wpautop_post,true)))) { remove_filter('the_content','wpautop'); remove_filter('the_excerpt','wpautop'); } } // Theme Editor Warning if($editor_warning==1 && atb_is_path('wp-admin/theme-editor.php?file=') && atb_is_path('php&theme')) { if(($editor_warning_role_exclude==0 && (count(array_intersect($editor_warning_role,$user_roles))>0 || in_array('*All',$editor_warning_role,true))) || ($editor_warning_role_exclude==1 && count(array_intersect($editor_warning_role,$user_roles))==0 && !in_array('*All',$editor_warning_role,true))) { function atb_editor() { ?> 0 || in_array('*All',$dual_auth_role,true))) || ($dual_auth_role_exclude==1 && count(array_intersect($dual_auth_role,$user_roles))==0 && !in_array('*All',$dual_auth_role,true))) { if(strlen(trim($_SERVER['REMOTE_ADDR']))>6) $auth_ip=trim($_SERVER['REMOTE_ADDR']); else $auth_ip='na'; if(isset($_SESSION['atb_flag']) && atb_is_path('/wp-admin') && strpos($dual_auth_ip_exclude,$auth_ip)===false) atb_email_token($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); } } } else add_action('admin_notices','atb_admin_notice'); ?>