Skip to content

Commit

Permalink
Merge pull request #5 from GuyPrimavera/v1.0
Browse files Browse the repository at this point in the history
v1.0
  • Loading branch information
GuyPrimavera authored Feb 13, 2018
2 parents 60945c3 + b30e82c commit 45c412c
Show file tree
Hide file tree
Showing 26 changed files with 3,893 additions and 255 deletions.
40 changes: 27 additions & 13 deletions admin/adminBar/adminBarLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@

// Admin Bar links

function aquila_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('vc_inline-admin-bar-link');
$wp_admin_bar->remove_menu('revslider');
$wp_admin_bar->remove_menu('customize');
$wp_admin_bar->remove_menu('themes');
$wp_admin_bar->remove_menu('widgets');
$wp_admin_bar->remove_menu('menus');

$aquilaOptions = get_option( 'aquila_settings' );

if(isset($aquilaOptions['aquila_chk_abLinks']) && $aquilaOptions['aquila_chk_abLinks'] == 1){

} else {

function aquila_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('vc_inline-admin-bar-link');
$wp_admin_bar->remove_menu('revslider');
$wp_admin_bar->remove_menu('customize');
$wp_admin_bar->remove_menu('themes');
$wp_admin_bar->remove_menu('widgets');
$wp_admin_bar->remove_menu('menus');
$wp_admin_bar->remove_menu('wpseo-menu');
$wp_admin_bar->remove_menu('ngg-menu');
$wp_admin_bar->remove_menu('w3tc');
$wp_admin_bar->remove_menu('all-in-one-seo-pack');
$wp_admin_bar->remove_menu('updraft_admin_node');
$wp_admin_bar->remove_menu('itsec_admin_bar_menu');

}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_links', 999 );

}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_links', 999 );

?>
1 change: 1 addition & 0 deletions admin/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
include('widgets/removeWidgets.php');
include('widgets/welcomeWidget.php');
include('widgets/supportWidget.php');
include('widgets/pluginWidget.php');

include('functions/addClasses.php');
include('functions/adminBarStyle.php');
Expand Down
2 changes: 1 addition & 1 deletion admin/functions/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Custom Footer
function aquila_admin_footer_admin () {
echo '&copy; 2016 - <a href="https://designbymito.com/" target="_blank">design by Mito</a>';
echo '<a href="https://designbymito.com/" target="_blank">design by Mito</a>';
}
add_filter('admin_footer_text', 'aquila_admin_footer_admin');

Expand Down
196 changes: 196 additions & 0 deletions admin/options.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<?php
add_action( 'admin_menu', 'aquila_add_admin_menu' );
add_action( 'admin_init', 'aquila_settings_init' );


function aquila_add_admin_menu( ) {

add_submenu_page( 'index.php', 'Aquila Settings', '<i class="aquila-aquila" style="font-size: 140%;float: right;line-height: 0.8;"></i> Aquila Settings', 'manage_options', 'aquilaSettings', 'aquila_options_page' );

}


function aquila_settings_init( ) {

register_setting( 'aatPage', 'aquila_settings' );

add_settings_section(
'aquila_aatPage_section',
__( 'Aquila Settings', 'aquila-admin-theme' ),
'aquila_settings_section_callback',
'aatPage'
);

add_settings_field(
'aquila_chk_abLinks',
__( 'Show <em>Adminbar</em> links?', 'aquila-admin-theme' ),
'aquila_chk_abLinks_render',
'aatPage',
'aquila_aatPage_section'
);

add_settings_field(
'aquila_chk_pluginSupport',
__( 'Show Editors <em>Plugins Support</em> metabox?', 'aquila-admin-theme' ),
'aquila_chk_pluginSupport_render',
'aatPage',
'aquila_aatPage_section'
);

add_settings_field(
'aquila_chk_dashBoxes',
__( 'Show all other <em>Dashboard metaboxes</em>?', 'aquila-admin-theme' ),
'aquila_chk_dashBoxes_render',
'aatPage',
'aquila_aatPage_section'
);

/*
add_settings_field(
'aquila_text_field_2',
__( 'Settings field description', 'aquila-admin-theme' ),
'aquila_text_field_2_render',
'aatPage',
'aquila_aatPage_section'
);
add_settings_field(
'aquila_radio_field_3',
__( 'Settings field description', 'aquila-admin-theme' ),
'aquila_radio_field_3_render',
'aatPage',
'aquila_aatPage_section'
);
add_settings_field(
'aquila_textarea_field_4',
__( 'Settings field description', 'aquila-admin-theme' ),
'aquila_textarea_field_4_render',
'aatPage',
'aquila_aatPage_section'
);
add_settings_field(
'aquila_select_field_5',
__( 'Settings field description', 'aquila-admin-theme' ),
'aquila_select_field_5_render',
'aatPage',
'aquila_aatPage_section'
);
*/

}


function aquila_chk_abLinks_render( ) {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_chk_abLinks'] ) ) { $aquilaABLinks = $options['aquila_chk_abLinks'];
} else { $aquilaABLinks = 0; };

?>
<input type='checkbox' name='aquila_settings[aquila_chk_abLinks]' <?php checked( $aquilaABLinks, 1 ); ?> value='1'>
<?php

}


function aquila_chk_pluginSupport_render( ) {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_chk_pluginSupport'] ) ) { $aquilaPluginSupport = $options['aquila_chk_pluginSupport'];
} else { $aquilaPluginSupport = 0; };

?>
<input type='checkbox' name='aquila_settings[aquila_chk_pluginSupport]' <?php checked( $aquilaPluginSupport, 1 ); ?> value='1'>
<?php

}

function aquila_chk_dashBoxes_render( ) {

$options = get_option( 'aquila_settings' );
if ( isset ( $options['aquila_chk_dashBoxes'] ) ) { $aquilaDashBoxes = $options['aquila_chk_dashBoxes'];
} else { $aquilaDashBoxes = 0; };

?>
<input type='checkbox' name='aquila_settings[aquila_chk_dashBoxes]' <?php checked( $aquilaDashBoxes, 1 ); ?> value='1'>
<?php

}

/*
function aquila_text_field_2_render( ) {
$options = get_option( 'aquila_settings' );
?>
<input type='text' name='aquila_settings[aquila_text_field_2]' value='<?php echo $options['aquila_text_field_2']; ?>'>
<?php
}
function aquila_radio_field_3_render( ) {
$options = get_option( 'aquila_settings' );
?>
<input type='radio' name='aquila_settings[aquila_radio_field_3]' <?php checked( $options['aquila_radio_field_3'], 1 ); ?> value='1'>
<?php
}
function aquila_textarea_field_4_render( ) {
$options = get_option( 'aquila_settings' );
?>
<textarea cols='40' rows='5' name='aquila_settings[aquila_textarea_field_4]'>
<?php echo $options['aquila_textarea_field_4']; ?>
</textarea>
<?php
}
function aquila_select_field_5_render( ) {
$options = get_option( 'aquila_settings' );
?>
<select name='aquila_settings[aquila_select_field_5]'>
<option value='1' <?php selected( $options['aquila_select_field_5'], 1 ); ?>>Option 1</option>
<option value='2' <?php selected( $options['aquila_select_field_5'], 2 ); ?>>Option 2</option>
</select>
<?php
}
*/

function aquila_settings_section_callback( ) {

echo __( '', 'aquila-admin-theme' );

}


function aquila_options_page( ) {

?>
<div class="wrap">
<form action='options.php' method='post'>

<h2><i class="aquila-aquila" style="font-size: 200%;line-height: 0.5;float: left;margin-right: 5px"></i></h2>

<?php
settings_fields( 'aatPage' );
do_settings_sections( 'aatPage' );
submit_button();
?>

</form>
</div>
<?php

}

?>
70 changes: 70 additions & 0 deletions admin/widgets/pluginWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php


function aquila_plugin_widget() {

$aquilaOptions = get_option( 'aquila_settings' );

if(isset($aquilaOptions['aquila_chk_pluginSupport']) && $aquilaOptions['aquila_chk_pluginSupport'] == 1){
$pluginCaps = 'edit_others_pages';
} else {
$pluginCaps = 'manage_options';
}


if (current_user_can( $pluginCaps )) {

wp_add_dashboard_widget(
'aquila-plugin-support',
'Plugins Support',
'aquila_plugin_widget_function'
);

}

}

add_action( 'wp_dashboard_setup', 'aquila_plugin_widget' );

function aquila_plugin_widget_function() {

echo "<p class='about-description'>";

$aquilaOptions = get_option( 'aquila_settings' );
if(isset($aquilaOptions['aquila_chk_pluginSupport']) && $aquilaOptions['aquila_chk_pluginSupport'] == 1){
echo " <p>Visible to <strong>Editors</strong>.</p> ";
} else {
echo " <p>Visible to <strong>Administrators</strong>.</p> ";
}

echo "<ul>";

if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

$allPlugins = get_plugins();
$allPluginsKeys = array_keys($allPlugins);

$Count = 0;
foreach ($allPlugins as $pluginItem) {

$pluginRootFile = $allPluginsKeys[$Count];
$pluginTitle = $pluginItem['Title'];
$pluginVersion = $pluginItem['Version'];
$pluginURI = $pluginItem['PluginURI'];
$pluginDomain = $pluginItem['TextDomain'];
$pluginStatus = is_plugin_active($pluginRootFile) ? 'active' : 'inactive';

if (($pluginStatus == "active") && ($pluginURI)) {
echo "<li><a href='" . $pluginURI . "' target='_blank'>" . $pluginTitle . "</a></li>";
}

$Count++;
}

echo "</ul></p>";
}


?>
40 changes: 24 additions & 16 deletions admin/widgets/removeWidgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@

// Remove widgets //

function aquila_admin_remove_dashboard_meta() {
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
remove_meta_box( 'ai_dashboard_widget', 'dashboard', 'normal' );
remove_meta_box( 'welcome-panel', 'dashboard', 'normal' );
remove_meta_box( 'dashboardb_range', 'dashboard', 'normal' );
remove_meta_box( 'sdf_dashboard_widget', 'dashboard', 'normal' );
remove_action('welcome_panel', 'wp_welcome_panel');
$aquilaOptions = get_option( 'aquila_settings' );

if(isset($aquilaOptions['aquila_chk_dashBoxes']) && $aquilaOptions['aquila_chk_dashBoxes'] == 1){

} else {

function aquila_admin_remove_dashboard_meta() {
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
remove_meta_box( 'ai_dashboard_widget', 'dashboard', 'normal' );
remove_meta_box( 'welcome-panel', 'dashboard', 'normal' );
remove_meta_box( 'dashboardb_range', 'dashboard', 'normal' );
remove_meta_box( 'sdf_dashboard_widget', 'dashboard', 'normal' );
remove_action('welcome_panel', 'wp_welcome_panel');
}
add_action( 'admin_init', 'aquila_admin_remove_dashboard_meta' );

}
add_action( 'admin_init', 'aquila_admin_remove_dashboard_meta' );

?>
Loading

0 comments on commit 45c412c

Please sign in to comment.