-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor JS snippet to use WP AJAX #109
Changes from 5 commits
d83ecd4
52f9fcd
74ca426
1a39d8e
5ab1823
50a3b43
0250ad2
6a086a8
305d590
7705dff
d14d1df
ae543f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
try { | ||
const statifyReq = new XMLHttpRequest(); | ||
statifyReq.open( | ||
'GET', | ||
document.getElementById('statify-js-snippet').getAttribute('data-home-url') | ||
+ '?statify_referrer=' + encodeURIComponent(document.referrer) | ||
+ '&statify_target=' + encodeURIComponent(location.pathname + location.search) | ||
var statifyReq = new XMLHttpRequest(); | ||
statifyReq.open( 'POST', statify_ajax.url, true ); | ||
statifyReq.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded;' ); | ||
statifyReq.send( | ||
'_ajax_nonce=' + statify_ajax.nonce + | ||
'&action=statify_track' + | ||
'&statify_referrer=' + encodeURIComponent( document.referrer ) + | ||
'&statify_target=' + encodeURIComponent( location.pathname + location.search ) | ||
); | ||
statifyReq.send(null); | ||
} catch (e) { | ||
} catch ( e ) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
define( 'STATIFY_FILE', __FILE__ ); | ||
define( 'STATIFY_DIR', dirname( __FILE__ ) ); | ||
define( 'STATIFY_BASE', plugin_basename( __FILE__ ) ); | ||
define( 'STATIFY_VERSION', '1.6.3' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be 1.7.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Absolutely (if we don‘t add this to 1.6.x - and I don‘t think so - or postpone this to 1.8 obviously) |
||
|
||
|
||
/* Hooks */ | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my mind there is not helpful. Also the hint on phpdoc - This tag should not be used for constructors or methods defined with a void return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using this tag in 15 places... Apparently all introduced by myself (default pattern in my IDE because it's mandatory in most of my styleguides - and btw. the PHPdoc ref marks this as "MAY be omitted").
We shouldn't mix it up, so either remove all or none.
Along with some int(eger) and bool(ean) tags probably little out of scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, plugincollektiv need a style guide, simplest way is the WP codex. In this context it is only a hint and the result of different views, works outside of the pluginkollektiv projects. Feel free to leave that or remove all ;)