-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ned Zimmerman
committed
Aug 10, 2016
0 parents
commit 1a46c1c
Showing
27 changed files
with
12,402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
|
||
[{.jshintrc,*.json,*.yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{*.txt,wp-config-sample.php}] | ||
end_of_line = crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
table { | ||
margin-left: 0; | ||
margin-top: 8em; | ||
width: 100%; | ||
} | ||
|
||
table td { | ||
padding: 1em; | ||
} | ||
|
||
.visualize { | ||
margin-left: 0; | ||
margin-top: 2em; | ||
} | ||
|
||
div.executive-summary { | ||
margin-top: 2em; | ||
padding: 1em; | ||
font-size: 13px; | ||
border: 1px dashed #ccc; | ||
} | ||
|
||
div.executive-summary p { | ||
line-height: .5em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
jQuery(function ($) { | ||
|
||
var myPalette = ['#B30000','#3300CC','#B3B300','#59B300','#B30059','#F00000','#FF2E2E','#00B300','#B300B3','#2EFFFF','#AFE495','#00B359','#FF66A3','#0000B3','#0059B3','#00B3B3']; | ||
|
||
$('table.pie-chart').visualize({ | ||
type: 'pie', | ||
pieMargin: 10, | ||
width: '350', | ||
height: '350', | ||
colors: myPalette | ||
}); | ||
|
||
|
||
$('table.line-chart').visualize({ | ||
type: 'line', | ||
width: '600', | ||
colors: myPalette | ||
}); | ||
|
||
|
||
$('table.area-chart').visualize({ | ||
type: 'area', | ||
width: '600', | ||
colors: myPalette | ||
}); | ||
|
||
|
||
$('table.bar-chart').visualize({ | ||
type: 'bar', | ||
width: '600', | ||
colors: myPalette | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "pressbooks/pressbooks-stats", | ||
"version": "1.0.0", | ||
"description": "A Pressbooks plugin which provides some basic activity statistics for a Pressbooks network.", | ||
"type": "wordpress-plugin", | ||
"license": "GPL-2.0+", | ||
"homepage": "https://github.com/pressbooks/pressbooks-stats", | ||
"authors": [ | ||
{ | ||
"name": "Book Oven Inc.", | ||
"email": "code@pressbooks.com", | ||
"homepage": "https://pressbooks.com" | ||
} | ||
], | ||
"keywords": [ | ||
"ebooks publishing webbooks stats statistics metrics" | ||
], | ||
"support": { | ||
"email": "code@pressbooks.com", | ||
"issues": "https://github.com/pressbooks/pressbooks-stats/issues", | ||
"docs": "https://github.com/pressbooks/pressbooks-stats/wiki" | ||
}, | ||
"minimum-stability": "dev", | ||
"require": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace PressbooksStats\Helpers; | ||
|
||
/** | ||
* Simple template system. | ||
* | ||
* @param string $path | ||
* @param array $vars (optional) | ||
* | ||
* @return string | ||
* @throws \Exception | ||
*/ | ||
function load_template( $path, array $vars = array() ) { | ||
|
||
if ( ! file_exists( $path ) ) { | ||
throw new \Exception( "File not found: $path" ); | ||
} | ||
|
||
ob_start(); | ||
extract( $vars ); | ||
include( $path ); | ||
$output = ob_get_contents(); | ||
ob_end_clean(); | ||
|
||
return $output; | ||
} | ||
|
||
// -------------------------------------------------------------------------------------------------------------------- | ||
// Activation & Deactivation | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
function install() { | ||
|
||
$db_version = '1.4'; | ||
|
||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); | ||
$table_name = 'wp_pressbooks_stats_exports'; | ||
$installed_ver = get_option( 'pb_stats_db_version' ); | ||
|
||
if ( $installed_ver != $db_version ) { | ||
$sql = "CREATE TABLE {$table_name} ( | ||
id mediumint(9) NOT NULL AUTO_INCREMENT, | ||
blog_id mediumint(9) NOT NULL, | ||
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, | ||
export_type VARCHAR(16) NOT NULL, | ||
user_id bigint(20) unsigned DEFAULT 0 NOT NULL, | ||
theme VARCHAR(32) NOT NULL, | ||
PRIMARY KEY id (id), | ||
KEY `export_theme` (`export_type`,`theme`), | ||
KEY `time` (`time`) | ||
); "; | ||
|
||
dbDelta( $sql ); | ||
update_option( 'pb_stats_db_version', $db_version ); | ||
} | ||
|
||
} |
Oops, something went wrong.