Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Regex change for CSS gene naming, made browscap optional and off by default #15

Merged
merged 4 commits into from

2 participants

@ddn

gene naming for HTML elements uses only class immediately name to left of v + variant

@gregdingle

does this actually work? it looks like you just copied the JS var name into the line

@gregdingle
Owner

It doesn't look like 2b3056b will work. Feel free to disable browscap on the server only. Don't worry about the client JS.

@ddn

Uh, yeah, my bad. I don't know what I was thinking there.

@ddn

Sorry about that. Should be correct now, tested it locally.

@gregdingle gregdingle was assigned
@gregdingle gregdingle merged commit 89c739a into from
@gregdingle
Owner

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 15 deletions.
  1. +2 −0  genetify/CONFIG.php
  2. +1 −1  genetify/genetify.js
  3. +17 −14 genetify/recorder.php
View
2  genetify/CONFIG.php
@@ -5,6 +5,8 @@
$DB['password'] = '';
$DB['database'] = 'genetify';
+$CONFIG['browscap'] = false; // browscap is defunct, turn off by default if & until a replacement is installed
+
// change as desired for debugging
error_reporting(E_ALL);
View
2  genetify/genetify.js
@@ -231,7 +231,7 @@ var genetify = {
// so then you could create your compound rules
// .myclass could modify the behavior of .myclass2.vA
- var geneNamePattern = '(.*)';
+ var geneNamePattern = '([A-Z0-9_$][a-zA-Z0-9_$\-]*)';
var markerPatternDict = {
'additiveCSSRules': '[a-zA-Z0-9_$]?\\.v',
'CSSRules': '_v',
View
31 genetify/recorder.php
@@ -377,25 +377,28 @@ function insert_new_visitor($ip_address)
{
global $mysqli;
+
$visitor = array('ip_address' => $ip_address);
+ // TODO: best delimiter?
+ $visitor['hash'] = md5(implode('', $visitor));
- //TODO: make optional
- require_once('Browscap/Browscap.php');
- $bc = new Browscap('cache');
- //TODO: make this configurable
- $bc->doAutoUpdate = 0;
- foreach ($bc->getBrowser() as $key => $value) {
+ if ($CONFIG['browscap']) {
+
+ //TODO: make optional
+ require_once('Browscap/Browscap.php');
+ $bc = new Browscap('cache');
+ //TODO: make this configurable
+ $bc->doAutoUpdate = 0;
+ foreach ($bc->getBrowser() as $key => $value) {
// filter out raw fields
- if (!strstr($key, 'browser_name')) {
- $visitor[$key] = $value;
+ if (!strstr($key, 'browser_name')) {
+ $visitor[$key] = $value;
+ }
}
- }
- //TODO: convert database column names
- // $visitor = _camel_to_underscore($visitor);
-
- // TODO: best delimiter?
- $visitor['hash'] = md5(implode('', $visitor));
+ //TODO: convert database column names
+ // $visitor = _camel_to_underscore($visitor);
+ }
$sql = "SELECT * FROM visitor WHERE visitor.hash = '" . $visitor['hash'] . "'";
$id = _get_unique_row_id('visitor', $sql);
Something went wrong with that request. Please try again.