Skip to content

Commit

Permalink
Merge pull request #14 from GuyPrimavera/v2.3
Browse files Browse the repository at this point in the history
v2.3
  • Loading branch information
GuyPrimavera authored Nov 13, 2018
2 parents 5513d02 + 907eabe commit a2c1ccd
Show file tree
Hide file tree
Showing 49 changed files with 2,879 additions and 707 deletions.
3 changes: 3 additions & 0 deletions admin/adminBar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

include('adminBar/customLogo.php');
include('adminBar/adminBarStyle.php');
include('adminBar/adminBarIcon.php');
include('adminBar/adminBarLinks.php');
include('adminBar/adminBarTitle.php');
include('adminBar/screenLinks.php');
Expand Down
35 changes: 35 additions & 0 deletions admin/adminBar/adminBarIcon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Add icon in place of admin bar
function aquila_adminbar_icon() {
if ( is_admin_bar_showing() ) {
$aquilaOptions = get_option( 'aquila_settings' );
if(isset($aquilaOptions['aquila_chk_abVisible']) && $aquilaOptions['aquila_chk_abVisible'] == 1) {
echo '<style>
.aquilaFront #wpadminbar {
display: block;
}
</style>';
}
echo '<div id="aquilaAdminbarIcon" title="Toggle Admin Bar"></div>';
}
}
add_action( 'admin_bar_menu', 'aquila_adminbar_icon', 999 );

// Add body class
function aquila_adminbar_open_class( $classes ) {
if ( is_admin_bar_showing() ) {
$aquilaOptions = get_option( 'aquila_settings' );
if(isset($aquilaOptions['aquila_chk_abVisible']) && $aquilaOptions['aquila_chk_abVisible'] == 1) {
$classes[] = 'aquilaOpenBar';
} else {
$classes[] = 'aquilaClosedBar';
}
return $classes;
} else {
return $classes;
}
}
add_filter('body_class', 'aquila_adminbar_open_class');

?>
56 changes: 20 additions & 36 deletions admin/adminBar/adminBarLinks.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Admin Bar links

$aquilaOptions = get_option( 'aquila_settings' );

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

// do nothing
} 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('customer-area');
$wp_admin_bar->remove_menu('itsec_admin_bar_menu');
$wp_admin_bar->remove_menu('maintenance_options');
$wp_admin_bar->remove_menu('tribe-events');
$wp_admin_bar->remove_menu('analytify');
$wp_admin_bar->remove_menu('cxssh-main-menu');
add_action( 'admin_bar_menu', 'aquila_admin_bar_cleanup', 200 );
function aquila_admin_bar_cleanup()
{
global $wp_admin_bar;
if ( !is_object( $wp_admin_bar ) ) {
return;
}

$nodes = $wp_admin_bar->get_nodes();
$nodesKeep = array('wp-logo', 'site-name', 'adminTitle', 'screenOptions', 'contextHelp', 'menu-toggle', 'my-account', 'view', 'edit');

foreach( $nodes as $node )
{
if( (!$node->parent || 'top-secondary' == $node->parent) && (!in_array($node->id, $nodesKeep)) ) {
$wp_admin_bar->remove_menu( $node->id );
//echo $node->id . '<br/>';
}
}
}
add_action( 'wp_before_admin_bar_render', 'aquila_admin_bar_links', 999 );

}

// Remove nodes

add_action( 'admin_bar_menu', 'aquila_remove_wp_logo_nodes', 999 );

function aquila_remove_wp_logo_nodes()
{
function aquila_remove_wp_logo_nodes() {
global $wp_admin_bar;
$wp_admin_bar->remove_node( 'about' );
$wp_admin_bar->remove_node( 'wporg' );
Expand All @@ -50,10 +39,8 @@ function aquila_remove_wp_logo_nodes()
}

// Add Aquila links

add_action('admin_bar_menu', 'aquila_wp_logo_links', 100);
function aquila_wp_logo_links($admin_bar){

$admin_bar->add_menu( array(
'id' => 'wpLessons',
'parent'=> 'wp-logo',
Expand All @@ -65,7 +52,6 @@ function aquila_wp_logo_links($admin_bar){
'target' => __('_blank'),
),
));

$admin_bar->add_menu( array(
'id' => 'wpGuide',
'parent'=> 'wp-logo',
Expand All @@ -77,7 +63,6 @@ function aquila_wp_logo_links($admin_bar){
'target' => __('_blank'),
),
));

$admin_bar->add_menu( array(
'id' => 'mitoSupport',
'parent'=> 'wp-logo-external',
Expand All @@ -89,7 +74,6 @@ function aquila_wp_logo_links($admin_bar){
'target' => __('_blank'),
),
));

}

?>
20 changes: 20 additions & 0 deletions admin/adminBar/adminBarStyle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Admin Bar height
function aquila_admin_bar() {
if ( is_admin_bar_showing() ) {
echo "<style type='text/css' media='screen'>
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 0px !important; }
* html body { margin-top: 0px !important; }
}
</style>
";
}
}
add_action( 'wp_head', 'aquila_admin_bar', 99 );
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );

?>
31 changes: 0 additions & 31 deletions admin/adminBar/adminBarTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
}

function aquila_adminbar_title($admin_bar){

$postType = false;
$postType = get_current_screen()->post_type;
$postTypeName = get_post_type_object( $postType );
$adminTitle = false;
$adminTitle = get_admin_page_title();

if ($adminTitle !== false && $postType !== false && is_admin()) {

$admin_bar->add_menu( array(
'id' => 'adminTitle',
'title' => $adminTitle,
Expand All @@ -22,34 +19,6 @@ function aquila_adminbar_title($admin_bar){
'title' => __($adminTitle),
),
));

/*
if ($postType !== false) {
$admin_bar->add_menu( array(
'id' => 'viewAll',
'parent' => 'adminTitle', // Rename when ready for "Add new"
'title' => 'All ' . $postTypeName->labels->name,
'href' => get_admin_url( ) . 'edit.php?post_type=' . $postType,
'meta' => array(
'title' => __('My Sub Menu Item'),
'target' => '_blank',
'class' => 'my_menu_item_class'
),
));
$admin_bar->add_menu( array(
'id' => 'my-second-sub-item',
'parent' => 'adminTitle',
'title' => 'New ' . $postTypeName->labels->singular_name,
'href' => get_admin_url( ) . 'post-new.php?post_type=' . $postType,
'meta' => array(
'title' => __('My Second Sub Menu Item'),
'target' => '_blank',
'class' => 'my_menu_item_class'
),
));
}
*/
}
}

Expand Down
111 changes: 111 additions & 0 deletions admin/adminBar/customLogo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

add_action('init', 'clean_output_buffer');
function clean_output_buffer() {
ob_start();
}

// Custom Logo
$aquilaLogoSettings = get_option( 'aquilaLogoSettings' );
$aquilaNewLogo = $aquilaLogoSettings['aquila_new_logo'];
$aquilaNewLogoSqr = $aquilaLogoSettings['aquila_new_logo_sqr'];

$GLOBALS['aquilaNewLogo'] = $aquilaNewLogo;
$GLOBALS['aquilaNewLogoSqr'] = $aquilaNewLogoSqr;

if( isset($aquilaLogoSettings['aquila_new_logo']) && $aquilaLogoSettings['aquila_new_logo'] !== "" ) {
add_action( 'admin_head', 'aquila_new_logo_admin', 90);
add_action( 'wp_head', 'aquila_new_logo_admin', 90);
add_action( 'login_head', 'aquila_new_logo_login', 90 );
}

// Custom Logo (square)
if( isset($aquilaLogoSettings['aquila_new_logo_sqr']) && $aquilaLogoSettings['aquila_new_logo_sqr'] !== "" ) {
add_action( 'admin_head', 'aquila_new_logo_sqr_admin', 90 );
add_action( 'wp_head', 'aquila_new_logo_sqr_admin', 90 );
}

// Admin bar
function aquila_new_logo_admin() {
echo "<style type='text/css'>
#wpadminbar li#wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
display: none!important;
}
#wpadminbar #wp-toolbar li#wp-admin-bar-wp-logo > .ab-item span.ab-icon {
background-image: url('" . $GLOBALS['aquilaNewLogo'] . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
margin: 0%!important;
max-width: 80%;
height: 70%;
top: 15%;
left: 10%;
}
#aquilaAdminbarIcon {
background-image: url('" . $GLOBALS['aquilaNewLogoSqr'] . "')!important;
background-size: 40px;
background-repeat: no-repeat;
background-position: center center;
}
#aquilaAdminbarIcon:before {
display: none!important;
}
body.folded #wpadminbar li#wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
display: none!important;
}
body.folded #wpadminbar #wp-toolbar li#wp-admin-bar-wp-logo > .ab-item span.ab-icon {
background-image: url('" . $GLOBALS['aquilaNewLogoSqr'] . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
margin: 0%!important;
max-width: 80%;
height: 70%;
top: 15%;
left: 10%;
}
</style>";
}

// Login screen
function aquila_new_logo_login() {
echo "<style type='text/css'>
body.login #login:before {
display: none!important;
}
body.login #login h1 a {
display: block!important;
}
body.login #login h1 a {
background-image: url('" . $GLOBALS['aquilaNewLogo'] . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
width: auto;
height: 80px;
max-width: 350px;
}
</style>";
}

function aquila_new_logo_sqr_admin() {
echo "<style type='text/css'>
body.folded #wpadminbar li#wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
display: none!important;
}
body.folded #wpadminbar #wp-toolbar li#wp-admin-bar-wp-logo > .ab-item span.ab-icon {
background-image: url('" . $GLOBALS['aquilaNewLogoSqr'] . "')!important;
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
margin: 0%!important;
max-width: 80%;
height: 80%;
top: 10%;
left: 10%;
}
</style>";
}

?>
1 change: 0 additions & 1 deletion admin/adminBar/removeHowdy.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

// Remove "How are you" //

function aquila_admin_bar_appearance() {
global $wp_admin_bar;
$user_id = get_current_user_id();
Expand Down
5 changes: 0 additions & 5 deletions admin/adminBar/screenLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

add_action('admin_bar_menu', 'new_screenlinks', 100);
function new_screenlinks($admin_bar){

$admin_bar->add_menu( array(
'id' => 'screenOptions',
'title' => '',
Expand All @@ -12,7 +11,6 @@ function new_screenlinks($admin_bar){
'class' => __('screenLink'),
),
));

$admin_bar->add_menu( array(
'id' => 'contextHelp',
'title' => '',
Expand All @@ -22,9 +20,6 @@ function new_screenlinks($admin_bar){
'class' => __('screenLink'),
),
));



}

?>
7 changes: 1 addition & 6 deletions admin/colour/bright.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
<?php
<?php if ( __FILE__ == $_SERVER['SCRIPT_FILENAME'] ) { exit; }

function bright($hex, $adjustment){

$adjustment = max(-255, min(255, $adjustment)); // Adjustment value is between 255 & -255
$hex = str_replace('#', '', $hex); //Remove # from string

//if hex value is 3 numbers set to 6
if (strlen($hex) == 3){
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
}

$colors = str_split($hex, 2); //split values into three channels
$adjusted_value = '#';

foreach($colors as $color) {
$color = hexdec($color); //convert to decimal
$color = max(0, min(255, $color + $adjustment)); //perform adjustment
$adjusted_value .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); //make two character hex code
}

return $adjusted_value;
}

Expand Down
Loading

0 comments on commit a2c1ccd

Please sign in to comment.