' . __('Settings','agg-advanced-settings') . '', );
return array_merge( $mylink, $links );
} // end function add_action_links
// Prevent cloning
public function __clone() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'agg-advanced-settings' ) );
} // end function __clone
// Prevent unserializing instances of this class
public function __wakeup() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'agg-advanced-settings' ) );
} // end function __wakeup
// Ensure that only one instance of this class is loaded and can be loaded
public static function instance() {
if( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
} // end function instance
// Hide "Powered by WordPress"
public function register_plugin_styles() {
wp_register_style( 'agg-advanced-settings', plugins_url( 'aggregator-advanced-settings/agg-advanced-settings.css' ) );
wp_enqueue_style( 'agg-advanced-settings' );
} // end function register_plugin_styles
// Redirect non-admin users
public function no_admin_init() {
// Is this the admin interface
if (
// Look for the presence of /wp-admin/ in the url
stripos($_SERVER['REQUEST_URI'],'/wp-admin') !== false
&&
// Allow calls to async-upload.php
stripos($_SERVER['REQUEST_URI'],'async-upload.php') == false
&&
// Allow calls to admin-ajax.php
stripos($_SERVER['REQUEST_URI'],'admin-ajax.php') == false
) {
// Does the current user fail the required capability level
if (!current_user_can('activate_plugins')) {
// Send a temporary redirect
wp_redirect(get_option('home'),302);
}
}
} // end function no_admin_init
// Hide admin bar
public function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
} // end function remove_admin_bar
// Set login style
public function set_login_stylesheet() {
wp_enqueue_style( 'custom-login', wp_get_theme(get_option( 'agg_set_login_style' ))->get_theme_root_uri() . '/' . wp_get_theme(get_option( 'agg_set_login_style' ))->get_stylesheet() . '/style.css' );
} // end function set_login_stylesheet
// Show custom logo in login
public function custom_login_logo() {
if ( has_custom_logo() ) {
$image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
?>