Adding Stats page
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 2 Feb 2015 19:20:12 +0000 (14:20 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 2 Feb 2015 19:20:12 +0000 (14:20 -0500)
Bring in the stats using iframe

Gaslightify.php

index 8138463..9d9fe7a 100755 (executable)
@@ -4,7 +4,7 @@
 Plugin Name: Gaslightify
 Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
 Description: A gasline to a Wordpress website.
-Version: 1.35   
+Version: 1.35
 Author: Gaslight Media
 Author URI: http://www.gaslightmedia.com
 License: Gaslight Media
@@ -22,10 +22,10 @@ add_action('admin_enqueue_scripts', 'interface_client_safeguard');
 function interface_client_safeguard() {
     if ( current_user_can( 'manage_options' ) ) {
         /* A user with admin privileges */
-        
+
     } else {
         /* A user without admin privileges */
-       wp_enqueue_script('GaslightifyJs', plugins_url('js/Gaslightify.js', __FILE__),array(),'1.0.0', true);
+        wp_enqueue_script('GaslightifyJs', plugins_url('js/Gaslightify.js', __FILE__),array(),'1.0.0', true);
         wp_enqueue_style('GaslightifyStyle', plugins_url('css/Gaslightify.css', __FILE__));
         if ( is_multisite() ) {
             wp_enqueue_style('GaslightifyMSStyle', plugins_url('css/GaslightifyMS.css', __FILE__));
@@ -33,7 +33,7 @@ function interface_client_safeguard() {
     }
     if (!current_user_can('edit_posts')) {
         ?>
-        <style type="text/css"> 
+        <style type="text/css">
             #menu-posts, #menu-comments {
                 display: none !important;
             }
@@ -62,7 +62,7 @@ function left_admin_footer_text_output($text) {
 //    $text = '<p>This Theme was made by <a href="http://www.gaslightmedia.com">Gaslight Media</a>.</p>';
     return $text;
 }
+
 add_filter('update_footer', 'right_admin_footer_text_output', 11, true); //right side
 function right_admin_footer_text_output($text) {
     $text = '';
@@ -85,24 +85,24 @@ add_action('admin_bar_menu', 'glm_custom_logo');
 
 function glm_custom_logo() {
     ?>
-    <style type="text/css"> 
-        
+    <style type="text/css">
+
         #adminmenu .wp-menu-image img {
-            content: url(<?php echo plugins_url(); ?>/Gaslightify/img/GLM_flame_box_inverted_16x16b.png) !important; 
+            content: url(<?php echo plugins_url(); ?>/Gaslightify/img/GLM_flame_box_inverted_16x16b.png) !important;
         }
-        #dashboard_activity .no-activity .smiley:before { 
+        #dashboard_activity .no-activity .smiley:before {
             content: url(<?php echo bloginfo('template_url', __FILE__); ?>/assets/DashboardActivityLogo.png);
         }
         #wp-admin-bar-wp-logo > .ab-item .ab-icon:before, #header-logo {
             content: url(<?php echo plugins_url(); ?>/Gaslightify/img/GLM_flame_none_trans_32x32.png) !important;
         }
         #wpadminbar .quicklinks li .blavatar:before {
-            content: url(<?php echo plugins_url(); ?>/Gaslightify/img/GLM_flame_none_trans_16x16.png) !important; 
+            content: url(<?php echo plugins_url(); ?>/Gaslightify/img/GLM_flame_none_trans_16x16.png) !important;
         }
-        
+
     </style>
     <?php
-    
+
 }
 
 add_action('login_form','my_login_logo');
@@ -128,7 +128,7 @@ function my_login_logo() { ?>
             background-size: auto;
         }
     </style>
-    
+
 <?php }
 
 function replace_howdy( $wp_admin_bar ) {
@@ -138,6 +138,31 @@ function replace_howdy( $wp_admin_bar ) {
     'id' => 'my-account',
     'title' => $newtitle,
     ) );
-    }
-    add_filter( 'admin_bar_menu', 'replace_howdy',25 );
+}
+add_filter( 'admin_bar_menu', 'replace_howdy',25 );
+function glm_stats(){
+    echo '<div class="wrap">
+        <style>
+        #glm_stats {
+            width: 84vw;
+            height: 84vh;
+        }
+        </style>
+        <iframe
+        frameborder="0"
+        width="100%"
+        marginheight="0"
+        marginwidth="0"
+        scrolling="0"
+        src="'.get_site_url().'/stats/"
+        seamless="true"
+        id="glm_stats"></iframe>
+        </div>
+';
+}
+function Gaslightify_menu() {
+    add_menu_page('Server Stats', 'Server Stats', 'edit_posts', 'glm_stats', 'glm_stats', 'dashicons-chart-area');
+}
+add_action('admin_menu', 'Gaslightify_menu');
+
 ?>