Commit efe4e965 authored by John Punzalan's avatar John Punzalan

Add repo Funasaka

parent be57b984
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Backend_Ajax' ) ) {
final class GADWP_Backend_Ajax {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) {
// Items action
add_action( 'wp_ajax_gadwp_backend_item_reports', array( $this, 'ajax_item_reports' ) );
}
if ( current_user_can( 'manage_options' ) ) {
// Admin Widget action
add_action( 'wp_ajax_gadwp_dismiss_notices', array( $this, 'ajax_dismiss_notices' ) );
}
}
/**
* Ajax handler for Item Reports
*
* @return json|int
*/
public function ajax_item_reports() {
if ( ! isset( $_POST['gadwp_security_backend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_backend_item_reports'], 'gadwp_backend_item_reports' ) ) {
wp_die( - 30 );
}
if ( isset( $_POST['projectId'] ) && $this->gadwp->config->options['switch_profile'] && $_POST['projectId'] !== 'false' ) {
$projectId = $_POST['projectId'];
} else {
$projectId = false;
}
$from = $_POST['from'];
$to = $_POST['to'];
$query = $_POST['query'];
if ( isset( $_POST['filter'] ) ) {
$filter_id = $_POST['filter'];
} else {
$filter_id = false;
}
if ( ob_get_length() ) {
ob_clean();
}
if ( ! ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( ( 1 == $this->gadwp->config->options['backend_item_reports'] ) || ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) ) ) {
wp_die( - 31 );
}
if ( $this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] && $from && $to ) {
if ( null === $this->gadwp->gapi_controller ) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die( - 24 );
}
if ( $projectId == false ) {
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
}
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
if ( isset( $profile_info[4] ) ) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
}
if ( $filter_id ) {
$uri_parts = explode( '/', get_permalink( $filter_id ), 4 );
if ( isset( $uri_parts[3] ) ) {
$uri = '/' . $uri_parts[3];
} else {
wp_die( - 25 );
}
// allow URL correction before sending an API request
$filter = apply_filters( 'gadwp_backenditem_uri', $uri, $filter_id );
$lastchar = substr( $filter, - 1 );
if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
$filter = $filter . $profile_info[6];
}
// Encode URL
$filter = rawurlencode( rawurldecode( $filter ) );
} else {
$filter = false;
}
$queries = explode( ',', $query );
$results = array();
foreach ( $queries as $value ) {
$results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
}
wp_send_json( $results );
}
/**
* Ajax handler for dismissing Admin notices
*
* @return json|int
*/
public function ajax_dismiss_notices() {
if ( ! isset( $_POST['gadwp_security_dismiss_notices'] ) || ! wp_verify_nonce( $_POST['gadwp_security_dismiss_notices'], 'gadwp_dismiss_notices' ) ) {
wp_die( - 30 );
}
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( - 31 );
}
delete_option( 'gadwp_got_updated' );
wp_die();
}
}
}
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/* Real-Time content */
.gadwp-pline {
width: 100%;
margin: 0 0;
padding: 5px 0 5px 0;
background: #fff;
-moz-box-shadow: 0px 0px 3px 0px #BBB;
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
box-shadow: 0px 0px 3px 0px #BBB;
display: table;
overflow: hidden;
}
.gadwp-pleft {
width: 90%;
float: left;
padding-left: 5px;
}
.gadwp-pright {
width: 5%;
float: right;
padding-right: 5px;
}
[id^=gadwp-realtime-] {
margin: 10px 0 0 0;
width: 100%;
}
.gadwp-rt-box {
width: 100%;
margin: 0 0;
background: #fff;
text-align: center;
-moz-box-shadow: 0px 0px 5px 0px #BBB;
-webkit-box-shadow: 0px 0px 5px 0px #BBB;
box-shadow: 0px 0px 5px 0px #BBB;
display: table;
}
.gadwp-tdo-left {
width: 60%;
padding: 33px 0;
float: left;
text-align: center;
}
.gadwp-tdo-right {
width: 35%;
margin: 0px 10px 0px 0;
text-align: left;
font-weight: bold;
vertical-align: middle;
float: right;
display: table;
}
.gadwp-online {
font-size: 100px;
font-weight: normal;
line-height: 1em;
margin: 0 auto;
width: 80%;
}
.gadwp-bigtext {
font-size: 14px;
width: 100%;
margin: 0 0;
padding: 5px 5px 5px 5px;
background: #fff;
-moz-box-shadow: 0px 0px 3px 0px #BBB;
-webkit-box-shadow: 0px 0px 3px 0px #BBB;
box-shadow: 0px 0px 3px 0px #BBB;
display: table;
overflow: hidden;
}
.gadwp-bleft {
float: left;
width: 80%;
}
.gadwp-bright {
float: right;
width: 20%;
}
.gadwp-pgdetailsr {
padding-left: 20px;
text-align: right;
}
.gadwp-pgdetailsl {
min-width: 250px;
}
[id^=gadwp-areachart-] {
width: 98%;
height: 100%;
margin: 10px auto 10px 0;
height: 250px;
}
.gadwp-floatwraper {
display: table;
width: 100%;
height: 100%;
}
[id^=gadwp-piechart-].halfsize {
width: 47%;
margin: 10px 0 0 0;
height: 200px;
float: left;
}
[id^=gadwp-piechart-].floatleft {
float: left;
}
[id^=gadwp-piechart-].floatright {
float: right;
}
[id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
width: 98%;
height: 100%;
margin: 10px auto 10px 0;
}
#dashboard-widgets-wrap .postbox {
margin-right: 10px;
}
/* Admin Widget content */
[id^=gadwp-progressbar-] {
width: 100%;
height: 3px;
margin: 5px 0 0px 0;
}
[id^=gadwp-bottomstats-] {
width: 100%;
}
[id^=gadwp-bottomstats-] .inside {
display: table;
margin: 0 auto;
padding: 0px;
}
#gadwp-widget .inside .small-box {
width: 30%;
float: left;
margin: 0 5px 10px 5px;
background: #fff;
text-align: center;
-moz-box-shadow: 0px 0px 7px 0px #BBB;
-webkit-box-shadow: 0px 0px 7px 0px #BBB;
box-shadow: 0px 0px 7px 0px #BBB;
}
#gadwp-widget .inside .small-box h3 {
font-size: 1em;
color: #777;
padding: 0px 5px 0px 5px;
margin: 0px 0px 0px 0px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
#gadwp-widget .inside .small-box p {
font-size: 1.2em;
margin: 0px 0px 2px 0px;
}
@media screen and (max-width: 410px) {
[id^=gadwp-bottomstats-] .inside .small-box {
width: 45%;
}
}
\ No newline at end of file
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/* Tab navigation */
#gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude, #gadwp-config {
display: none;
}
/* Options pages */
table.gadwp-settings-options {
padding-left: 10px;
width: 100%;
}
.gadwp-settings-options td {
padding: 0px 5px 5px 5px;
}
td.gadwp-settings-title, td.info {
width: 130px;
padding-left: 20px;
}
td.gadwp-settings-title-s {
width: 300px;
}
.gadwp-help {
padding-left: 15px;
}
td.gadwp-settings-info {
padding-bottom: 15px;
}
td.gadwp-settings-title label {
font-weight: bold;
}
.gadash-title {
float: left;
margin-right: 10px;
margin-top: 2px;
clear: left;
}
.gadash-desc {
font-size: 1em;
}
.gadash-top {
vertical-align: top;
}
pre.gadwp-settings-logdata {
white-space: pre-wrap;
}
td.gadwp-settings-roles {
padding-bottom: 15px;
}
#ga_speed_samplerate, #ga_realtime_pages {
width: 50px;
}
#gapi-access-code {
color: red !important;
}
#poststuff.gadwp h2 {
padding-bottom: 0;
font-size: 19.5px;
font-weight: normal;
padding: 0;
margin: 20px 0 15px 0;
}
#poststuff.gadwp h2.nav-tab-wrapper {
border-bottom: 1px solid #ccc;
padding-bottom: 0;
}
/* Options pages ON/OFF Switch */
.button-primary.gadwp-settings-switchoo {
position: relative;
width: 50px;
float: left;
border: none;
padding: 0;
height: 22px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
input.gadwp-settings-switchoo-checkbox {
display: none;
}
.gadwp-settings-switchoo-label {
display: block;
overflow: hidden;
cursor: pointer;
background: transparent;
border: 1px solid #ddd;
border-radius: 2px;
text-shadow: none;
}
.gadwp-settings-switchoo-inner {
width: 200%;
margin-left: -100%;
border-radius: 2px;
-moz-transition: margin 0.2s ease-in 0s;
-webkit-transition: margin 0.2s ease-in 0s;
-o-transition: margin 0.2s ease-in 0s;
transition: margin 0.2s ease-in 0s;
}
.gadwp-settings-switchoo-inner:before, .gadwp-settings-switchoo-inner:after {
float: left;
width: 50%;
font-weight: normal;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
height: 22px;
line-height: 22px;
font-size: 12px;
text-shadow: none;
}
.gadwp-settings-switchoo-inner:before {
content: "On";
padding-left: 5px;
border-bottom: none;
/* background-color: #00a0d2;
color: #fff; /* inherit from button props */
}
.gadwp-settings-switchoo-inner:after {
content: "Off";
padding-right: 5px;
background-color: #ddd;
text-align: right;
}
.gadwp-settings-switchoo-switch {
width: 22px;
height: 22px;
background: #fff;
color: #ddd;
border: 1px solid #ddd;
border-radius: 2px;
position: absolute;
top: 0;
bottom: 0;
right: 27px;
-moz-transition: all 0.2s ease-in 0s;
-webkit-transition: all 0.2s ease-in 0s;
-o-transition: all 0.2s ease-in 0s;
transition: all 0.2s ease-in 0s;
}
.gadwp-settings-switchoo-switch:hover {
color: #aaa;
border-color: #aaa;
}
.gadwp-settings-switchoo-switch:after {
margin: 0;
outline: 0;
display: inline-block;
font: 400 16px/16px dashicons;
content: "\f228";
padding: 3px 0 0 3px;
text-align: left;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-inner {
margin-left: 0;
}
.gadwp-settings-switchoo-checkbox:checked+.gadwp-settings-switchoo-label .gadwp-settings-switchoo-switch {
right: 0px;
}
.switch-desc {
float: left;
margin-left: 10px;
line-height: 20px;
}
\ No newline at end of file
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/* Backend Item Reports */
.column-gadwp_stats {
width: 70px;
}
.gadwp-icon {
color: #555;
}
.gadwp-icon:hover {
color: #2ea2cc;
}
.gadwp-icon-oldwp {
padding-top: 5px;
}
[id^=gadwp-container-] {
width: 480px;
}
[id^=gadwp-areachart-] {
height: 280px;
}
[id^=gadwp-progressbar-] {
width: 100%;
height: 3px;
margin: 5px 0 0px 0;
}
[id^=gadwp-bottomstats-] {
width: 100%;
}
[id^=gadwp-bottomstats-] .inside {
display: table;
margin: 0 auto;
padding: 0px;
}
[id^=gadwp-bottomstats-] .inside .small-box {
width: 31.2%;
float: left;
margin: 10px 5px 10px 5px;
background: #fff;
text-align: center;
-moz-box-shadow: 0px 0px 7px 0px #BBB;
-webkit-box-shadow: 0px 0px 7px 0px #BBB;
box-shadow: 0px 0px 7px 0px #BBB;
}
[id^=gadwp-bottomstats-] .inside .small-box h3 {
font-family: 'Open Sans', sans-serif;
font-size: 1em;
color: #777;
padding: 0px 5px 0px 5px;
margin: 0px 0px 0px 0px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
[id^=gadwp-bottomstats-] .inside .small-box p {
font-size: 1.2em;
margin: 0px 0px 2px 0px;
}
.gadwp-floatwraper {
display: table;
width: 100%;
height: 100%;
}
[id^=gadwp-piechart-].halfsize {
width: 47%;
margin: 10px 0 0 0;
height: 200px;
float: left;
}
[id^=gadwp-piechart-].floatleft {
float: left;
}
[id^=gadwp-piechart-].floatright {
float: right;
}
[id^=gadwp-tablechart-], [id^=gadwp-tablechart-] {
margin: 10px 0 0 0;
}
.gadwp .ui-dialog-titlebar {
font-size: 1.1em;
text-overflow: ellipsis;
overflow: hidden;
}
@media screen and (max-width: 500px) {
[id^=gadwp-container-] {
width: 410px;
}
[id^=gadwp-bottomstats-] .inside .small-box {
width: 30.8%;
}
}
@media screen and (max-width: 410px) {
[id^=gadwp-container-] {
width: 260px;
}
[id^=gadwp-bottomstats-] .inside .small-box {
width: 46%;
}
}
\ No newline at end of file
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Backend_Item_Reports' ) ) {
final class GADWP_Backend_Item_Reports {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && 1 == $this->gadwp->config->options['backend_item_reports'] ) {
// Add custom column in Posts List
add_filter( 'manage_posts_columns', array( $this, 'add_columns' ) );
// Populate custom column in Posts List
add_action( 'manage_posts_custom_column', array( $this, 'add_icons' ), 10, 2 );
// Add custom column in Pages List
add_filter( 'manage_pages_columns', array( $this, 'add_columns' ) );
// Populate custom column in Pages List
add_action( 'manage_pages_custom_column', array( $this, 'add_icons' ), 10, 2 );
}
}
public function add_icons( $column, $id ) {
global $wp_version;
if ( $column != 'gadwp_stats' ) {
return;
}
if ( version_compare( $wp_version, '3.8.0', '>=' ) ) {
echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
} else {
echo '<a id="gadwp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '"><img class="gadwp-icon-oldwp" src="' . GADWP_URL . 'admin/images/gadash-icon.png"</a>';
}
}
public function add_columns( $columns ) {
return array_merge( $columns, array( 'gadwp_stats' => __( 'Analytics', 'google-analytics-dashboard-for-wp' ) ) );
}
}
}
/*-
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/*
* Navigation Tabs
*/
jQuery( document ).ready( function () {
if ( window.location.href.indexOf( "page=gadash_" ) != -1 ) {
var ident = 'basic';
if ( window.location.hash ) {
ident = window.location.hash.split( '#' )[ 2 ].split( '-' )[ 1 ];
} else if ( window.location.href.indexOf( "page=gadash_errors_debugging" ) != -1 ) {
ident = 'errors';
}
jQuery( ".nav-tab-wrapper a" ).each( function ( index ) {
jQuery( this ).removeClass( "nav-tab-active" );
jQuery( "#" + this.hash.split( '#' )[ 2 ] ).hide();
} );
jQuery( "#tab-" + ident ).addClass( "nav-tab-active" );
jQuery( "#gadwp-" + ident ).show();
}
jQuery( 'a[href^="#"]' ).click( function ( e ) {
if ( window.location.href.indexOf( "page=gadash_" ) != -1 ) {
jQuery( ".nav-tab-wrapper a" ).each( function ( index ) {
jQuery( this ).removeClass( "nav-tab-active" );
jQuery( "#" + this.hash.split( '#' )[ 2 ] ).hide();
} );
jQuery( this ).addClass( "nav-tab-active" );
jQuery( "#" + this.hash.split( '#' )[ 2 ] ).show();
}
} );
} );
\ No newline at end of file
/*-
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
"use strict";
jQuery( document ).ready( function () {
var gadwp_ui = {
action : 'gadwp_dismiss_notices',
gadwp_security_dismiss_notices : gadwp_ui_data.security,
}
jQuery( "#gadwp-notice .notice-dismiss" ).click( function () {
jQuery.post( gadwp_ui_data.ajaxurl, gadwp_ui );
} );
if ( gadwp_ui_data.ed_bubble != '' ) {
jQuery( '#toplevel_page_gadash_settings li > a[href*="page=gadash_errors_debugging"]' ).append( '&nbsp;<span class="awaiting-mod count-1"><span class="pending-count" style="padding:0 7px;">' + gadwp_ui_data.ed_bubble + '</span></span>' );
}
} );
\ No newline at end of file
/*-
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
jQuery( document ).ready( function () {
jQuery( '.ga_dash_style' ).wpColorPicker();
} );
\ No newline at end of file
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Backend_Widgets' ) ) {
class GADWP_Backend_Widgets {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) && ( 1 == $this->gadwp->config->options['dashboard_widget'] ) ) {
add_action( 'wp_dashboard_setup', array( $this, 'add_widget' ) );
}
}
public function add_widget() {
wp_add_dashboard_widget( 'gadwp-widget', __( "Google Analytics Dashboard", 'google-analytics-dashboard-for-wp' ), array( $this, 'dashboard_widget' ), $control_callback = null );
}
public function dashboard_widget() {
$projectId = 0;
if ( empty( $this->gadwp->config->options['ga_dash_token'] ) ) {
echo '<p>' . __( "This plugin needs an authorization:", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Authorize Plugin", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
return;
}
if ( current_user_can( 'manage_options' ) ) {
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
} else {
echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
return;
}
} else {
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
} else {
echo '<p>' . __( "An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp' ) . '</p><form action="' . menu_page_url( 'gadash_settings', false ) . '" method="POST">' . get_submit_button( __( "Select Domain", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
return;
}
}
if ( ! ( $projectId ) ) {
echo '<p>' . __( "Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp' ) . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button( __( "Find out more!", 'google-analytics-dashboard-for-wp' ), 'secondary' ) . '</form>';
return;
}
?>
<div id="gadwp-window-1"></div>
<?php
}
}
}
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Common_Ajax' ) ) {
final class GADWP_Common_Ajax {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_back'] ) || GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) ) {
add_action( 'wp_ajax_gadwp_set_error', array( $this, 'ajax_set_error' ) );
}
}
/**
* Ajax handler for storing JavaScript Errors
*
* @return json|int
*/
public function ajax_set_error() {
if ( ! isset( $_POST['gadwp_security_set_error'] ) || ! ( wp_verify_nonce( $_POST['gadwp_security_set_error'], 'gadwp_backend_item_reports' ) || wp_verify_nonce( $_POST['gadwp_security_set_error'], 'gadwp_frontend_item_reports' ) ) ) {
wp_die( - 40 );
}
GADWP_Tools::set_cache( 'last_error', date( 'Y-m-d H:i:s' ) . ': ' . esc_html( $_POST['response'] ), 24 * 60 * 60 );
wp_die();
}
}
}
#nprogress {
pointer-events: none;
}
#nprogress .bar {
background: #29d;
position: fixed;
z-index: 1031;
top: 0;
left: 0;
width: 100%;
height: 2px;
}
/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0;
-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}
/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}
#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;
border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-radius: 50%;
-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}
.nprogress-custom-parent {
overflow: hidden;
position: relative;
}
.nprogress-custom-parent #nprogress .spinner, .nprogress-custom-parent #nprogress .bar {
position: absolute;
}
@
-webkit-keyframes nprogress-spinner { 0% {
-webkit-transform: rotate(0deg);
}
100%
{
-webkit-transform
:
rotate
(360deg);
}
}
@
keyframes nprogress-spinner { 0% {
transform: rotate(0deg);
}
100%
{
transform
:
rotate
(360deg);
}
}
\ No newline at end of file
/*! jQuery UI - v1.9.2 - 2013-09-22
* http://jqueryui.com
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
.ui-tooltip.gadwp {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa
}
* html .ui-tooltip.gadwp {
background-image: none
}
body .ui-tooltip.gadwp {
border-width: 2px
}
.ui-widget.gadwp {
font-family: Verdana, Arial, sans-serif;
font-size: 1.1em;
}
.ui-widget.gadwp .ui-widget {
font-size: 1em;
}
.ui-widget.gadwp input, .ui-widget.gadwp select, .ui-widget.gadwp textarea, .ui-widget.gadwp button {
font-family: Verdana, Arial, sans-serif;
font-size: 1em;
}
.ui-widget-content.gadwp {
border: 1px solid #aaaaaa;
background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
color: #222222;
}
.ui-widget-content.gadwp a {
color: #222222;
}
.gadwp .ui-widget-header {
border: 1px solid #aaaaaa;
background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
color: #222222;
font-weight: bold;
}
.gadwp .ui-widget-header a {
color: #222222;
}
\ No newline at end of file
/*-
* Author: Alin Marcu Author
* URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
jQuery(function () {
jQuery('#gadwp-widget *').tooltip({
items: "[data-gadwp]",
content: function () {
return jQuery(this).attr("data-gadwp");
}
});
});
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Frontend_Ajax' ) ) {
final class GADWP_Frontend_Ajax {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) && $this->gadwp->config->options['frontend_item_reports'] ) {
// Item Reports action
add_action( 'wp_ajax_gadwp_frontend_item_reports', array( $this, 'ajax_item_reports' ) );
}
// Frontend Widget actions
add_action( 'wp_ajax_ajax_frontwidget_report', array( $this, 'ajax_frontend_widget' ) );
add_action( 'wp_ajax_nopriv_ajax_frontwidget_report', array( $this, 'ajax_frontend_widget' ) );
}
/**
* Ajax handler for Item Reports
*
* @return string|int
*/
public function ajax_item_reports() {
if ( ! isset( $_POST['gadwp_security_frontend_item_reports'] ) || ! wp_verify_nonce( $_POST['gadwp_security_frontend_item_reports'], 'gadwp_frontend_item_reports' ) ) {
wp_die( - 30 );
}
$from = $_POST['from'];
$to = $_POST['to'];
$query = $_POST['query'];
$uri = $_POST['filter'];
$query = $_POST['query'];
if ( ob_get_length() ) {
ob_clean();
}
if ( ! GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) || 0 == $this->gadwp->config->options['frontend_item_reports'] ) {
wp_die( - 31 );
}
if ( $this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
if ( null === $this->gadwp->gapi_controller ) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die( - 24 );
}
if ( $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
} else {
wp_die( - 26 );
}
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
if ( isset( $profile_info[4] ) ) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
}
$uri = '/' . ltrim( $uri, '/' );
// allow URL correction before sending an API request
$filter = apply_filters( 'gadwp_frontenditem_uri', $uri );
$lastchar = substr( $filter, - 1 );
if ( isset( $profile_info[6] ) && $profile_info[6] && $lastchar == '/' ) {
$filter = $filter . $profile_info[6];
}
// Encode URL
$filter = rawurlencode( rawurldecode( $filter ) );
$queries = explode( ',', $query );
$results = array();
foreach ( $queries as $value ) {
$results[] = $this->gadwp->gapi_controller->get( $projectId, $value, $from, $to, $filter );
}
wp_send_json( $results );
}
/**
* Ajax handler for getting analytics data for frontend Widget
*
* @return string|int
*/
public function ajax_frontend_widget() {
if ( ! isset( $_POST['gadwp_number'] ) || ! isset( $_POST['gadwp_optionname'] ) || ! is_active_widget( false, false, 'gadwp-frontwidget-report' ) ) {
wp_die( - 30 );
}
$widget_index = $_POST['gadwp_number'];
$option_name = $_POST['gadwp_optionname'];
$options = get_option( $option_name );
if ( isset( $options[$widget_index] ) ) {
$instance = $options[$widget_index];
} else {
wp_die( - 32 );
}
switch ( $instance['period'] ) { // make sure we have a valid request
case '7daysAgo' :
$period = '7daysAgo';
break;
case '14daysAgo' :
$period = '14daysAgo';
break;
default :
$period = '30daysAgo';
break;
}
if ( ob_get_length() ) {
ob_clean();
}
if ( $this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] ) {
if ( null === $this->gadwp->gapi_controller ) {
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
}
} else {
wp_die( - 24 );
}
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
$profile_info = GADWP_Tools::get_selected_profile( $this->gadwp->config->options['ga_dash_profile_list'], $projectId );
if ( isset( $profile_info[4] ) ) {
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
} else {
$this->gadwp->gapi_controller->timeshift = (int) current_time( 'timestamp' ) - time();
}
wp_send_json( $this->gadwp->gapi_controller->frontend_widget_stats( $projectId, $period, (int) $instance['anonim'] ) );
}
}
}
<?php
/**
* Author: Alin Marcu
* Author URI: https://deconf.com
* Copyright 2013 Alin Marcu
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) )
exit();
if ( ! class_exists( 'GADWP_Frontend_Item_Reports' ) ) {
final class GADWP_Frontend_Item_Reports {
private $gadwp;
public function __construct() {
$this->gadwp = GADWP();
add_action( 'admin_bar_menu', array( $this, 'custom_adminbar_node' ), 999 );
}
function custom_adminbar_node( $wp_admin_bar ) {
if ( GADWP_Tools::check_roles( $this->gadwp->config->options['ga_dash_access_front'] ) && $this->gadwp->config->options['frontend_item_reports'] ) {
/* @formatter:off */
$args = array( 'id' => 'gadwp-1',
'title' => '<span class="ab-icon"></span><span class="">' . __( "Analytics", 'google-analytics-dashboard-for-wp' ) . '</span>',
'href' => '#1',
);
/* @formatter:on */
$wp_admin_bar->add_node( $args );
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment