' . __('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
// Show admin notices
public function admin_notice() {
global $current_screen;
if ( $current_screen->parent_base == 'options-general' ) {
echo '
';
}
} // end function admin_notice
// 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
// Show all settings
public function show_all_settings() {
global $submenu;
$permalink = get_site_url() . '/wp-admin/options.php';
$submenu['options-general.php'][] = array( __("All Settings", 'agg-advanced-settings' ), 'manage_options', $permalink);
} // end function Show all settings
// Disable RSS feeds
public function disable_feed() {
wp_redirect( home_url() );
} // end function disable_feed
// 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' );
?>