Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
4.4.4 (#173)
Browse files Browse the repository at this point in the history
* Changes...

- Update dependencies.
- Convert from a mutation to non-mutation in RISParser method.
- Prevent uncaught exception from being thrown when CSL is added without
a title by intercepting it before it's able to be added. (Closes #172)

* Remove sourcemaps from rollbar since they dont work properly

* Turn off uncaught reporting for rollbar

* Update deps

* Build release + bump to version 4.4.4
  • Loading branch information
dsifford authored Sep 29, 2016
1 parent b40bbbc commit 4795a42
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 53 deletions.
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Please use this template for all bug reports. -->
<!-- Before submitting an issue, please try disabling all other plugins to ensure the issue is isolated within ABT -->

**ABT Version:** 4.4.3
**ABT Version:** 4.4.4

<!-- Which version of PHP are you using with your WordPress installation? -->
**PHP Version:** 5.6
Expand Down
7 changes: 2 additions & 5 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ gulp.task('bump', () => {

gulp.task('rollbar', () =>
gulp.src('dist/lib/php/dom-injects.php', { base: './' })
.pipe(replace(/(payload: {\n.+?environment: "test"\n.+?},)/, ''))
.pipe(replace(/(\s+code_version: ")[\d.]+(",)/, `$1${VERSION}$2`))
.pipe(replace(/(^\s+environment: ")(test)(",)/gm, '$1production$3'))
.pipe(gulp.dest('./'))
);

Expand Down Expand Up @@ -198,8 +197,7 @@ gulp.task('webpack:prod', () =>

gulp.task('js', () =>
gulp
.src('dist/lib/**/*.js', { base: 'dist' })
.pipe(sourcemaps.init())
.src('dist/**/*.js', { base: 'dist' })
.pipe(uglify({
compress: {
dead_code: true,
Expand All @@ -208,7 +206,6 @@ gulp.task('js', () =>
drop_console: true,
},
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
);

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "academic-bloggers-toolkit",
"version": "4.4.3",
"version": "4.4.4",
"description": "A plugin extending the functionality of WordPress for Academic Blogging.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -31,20 +31,20 @@
"devDependencies": {
"autoprefixer": "^6.5.0",
"awesome-typescript-loader": "^2.2.4",
"babel-core": "^6.14.0",
"babel-core": "^6.16.0",
"babel-loader": "^6.2.5",
"babel-polyfill": "^6.13.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-register": "^6.14.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-register": "^6.16.3",
"browser-sync": "^2.16.0",
"coveralls": "^2.11.14",
"css-loader": "^0.25.0",
"del": "^2.2.2",
"enzyme": "^2.4.1",
"eslint": "^3.6.1",
"eslint-config-airbnb-base": "^8.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-import": "^2.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-replace": "^0.5.4",
"gulp-sort": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/academic-bloggers-toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* Plugin Name: Academic Blogger's Toolkit
* Plugin URI: https://wordpress.org/plugins/academic-bloggers-toolkit/
* Description: A plugin extending the functionality of Wordpress for academic blogging
* Version: 4.4.3
* Version: 4.4.4
* Author: Derek P Sifford
* Author URI: https://github.com/dsifford
* License: GPL3 or later
* Text Domain: academic-bloggers-toolkit
*/

define('ABT_VERSION', '4.4.3');
define('ABT_VERSION', '4.4.4');


/**
Expand Down
6 changes: 3 additions & 3 deletions src/academic-bloggers-toolkit.pot
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (C) 2016 Academic Blogger's Toolkit 4.4.3
# This file is distributed under the same license as the Academic Blogger's Toolkit 4.4.3 package.
# Copyright (C) 2016 Academic Blogger's Toolkit 4.4.4
# This file is distributed under the same license as the Academic Blogger's Toolkit 4.4.4 package.
msgid ""
msgstr ""
"Project-Id-Version: Academic Blogger's Toolkit 4.4.3\n"
"Project-Id-Version: Academic Blogger's Toolkit 4.4.4\n"
"Report-Msgid-Bugs-To: https://github.com/dsifford/academic-bloggers-toolkit/issues\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down
1 change: 1 addition & 0 deletions src/lib/js/reference-list/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CitationStore {
this.CSL = this.cleanCSL(CSL);
intercept(this.CSL, (change) => {
if (change.type !== 'add') return change;
if (!change.newValue.title) return null;
const title = change.newValue.title.toLowerCase();
const matchIndex: number = this.CSL.values().findIndex(v => v.title.toLowerCase() === title);
if (matchIndex > -1) {
Expand Down
7 changes: 7 additions & 0 deletions src/lib/js/reference-list/__tests__/Store-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ describe('Reflist Store', () => {
expect(store.citations.CSL.keys().length).toBe(3);
});

it('should intercept a citation that has no title set', () => {
expect(store.citations.CSL.keys().length).toBe(3);
const invalidCSL = { PMID: '11223344', type: 'article-journal' };
store.citations.CSL.set('invalidCSL', invalidCSL);
expect(store.citations.CSL.keys().length).toBe(3);
});

it('should allow non-existing CSL to be set', () => {
const cite = JSON.parse(JSON.stringify(store.citations.CSL.get('citationId')));
cite.title = 'Something different';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const setupAutocite = (kind: 'book'|'chapter'|'webpage' = 'webpage', inputType:
getter={spy}
kind={kind}
placeholder="Testing"
type={inputType}
inputType={inputType}
/>
);
return {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/js/utils/RISParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export class RISParser {
this.refArray.forEach((ref: string, i: number) => {
const refObj = this.parseSingle(ref, i);

if (typeof refObj === 'boolean') {
this.unsupportedRefs.push(i + 1);
if (typeof refObj === 'boolean' || !refObj.title) {
this.unsupportedRefs = [...this.unsupportedRefs, i + 1];
return;
}
payload.push(refObj);
Expand Down
48 changes: 17 additions & 31 deletions src/lib/php/dom-injects.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,33 @@ function abt_append_rollbar_script() {

if ($not_editor_page || $invalid_post_type) return;

$site_name = get_bloginfo();
$url = get_bloginfo('url');
$phpversion = phpversion();
$user_name = $current_user->display_name;
$user_email = $current_user->user_email;
$theme = get_template();
$plugins = wp_json_encode(get_option('active_plugins'));
$jsvar = "Rollbar.configure({
payload: {
site: {
name: '$site_name',
php_version: '$phpversion',
plugins: $plugins,
theme: '$theme',
url: '$url',
},
person: {
name: '$user_name',
email: '$user_email',
},
},
});";

?>
<script id="rollbar-config" type="text/javascript">
var _rollbarConfig = {
accessToken: "d4a261f761fb47ecaef17670b3c59f32",
captureUncaught: false,
payload: {
environment: "test"
},
client: {
javascript: {
source_map_enabled: true,
code_version: "0.0.0",
guess_uncaught_frames: true,
environment: "test",
site: {
language: '<?php echo get_bloginfo('language') ?>',
name: '<?php echo get_bloginfo('name') ?>',
plugins: <?php echo wp_json_encode(get_option('active_plugins')) ?>,
theme: '<?php echo get_template() ?>',
url: '<?php echo get_bloginfo('url') ?>',
},
person: {
id: '<?php echo get_bloginfo('name') ?>',
username: '<?php echo $current_user->display_name ?>',
email: '<?php echo $current_user->user_email ?>',
},
versions: {
abt: '<?php echo ABT_VERSION ?>',
php: '<?php echo phpversion() ?>',
wordpress: '<?php echo get_bloginfo('version') ?>',
},
},
};
!function(r){function e(t){if(o[t])return o[t].exports;var n=o[t]={exports:{},id:t,loaded:!1};return r[t].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var t=o(1).Rollbar,n=o(2);_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://d37gvrvc0wt4s1.cloudfront.net/js/v1.9/rollbar.min.js";var a=t.init(window,_rollbarConfig),i=n(a,_rollbarConfig);a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,i)},function(r,e){"use strict";function o(r){return function(){try{return r.apply(this,arguments)}catch(e){try{console.error("[Rollbar]: Internal error",e)}catch(o){}}}}function t(r,e,o){window._rollbarWrappedError&&(o[4]||(o[4]=window._rollbarWrappedError),o[5]||(o[5]=window._rollbarWrappedError._rollbarContext),window._rollbarWrappedError=null),r.uncaughtError.apply(r,o),e&&e.apply(window,o)}function n(r){var e=function(){var e=Array.prototype.slice.call(arguments,0);t(r,r._rollbarOldOnError,e)};return e.belongsToShim=!0,e}function a(r){this.shimId=++c,this.notifier=null,this.parentShim=r,this._rollbarOldOnError=null}function i(r){var e=a;return o(function(){if(this.notifier)return this.notifier[r].apply(this.notifier,arguments);var o=this,t="scope"===r;t&&(o=new e(this));var n=Array.prototype.slice.call(arguments,0),a={shim:o,method:r,args:n,ts:new Date};return window._rollbarShimQueue.push(a),t?o:void 0})}function l(r,e){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){var o=e.addEventListener;e.addEventListener=function(e,t,n){o.call(this,e,r.wrap(t),n)};var t=e.removeEventListener;e.removeEventListener=function(r,e,o){t.call(this,r,e&&e._wrapped?e._wrapped:e,o)}}}var c=0;a.init=function(r,e){var t=e.globalAlias||"Rollbar";if("object"==typeof r[t])return r[t];r._rollbarShimQueue=[],r._rollbarWrappedError=null,e=e||{};var i=new a;return o(function(){if(i.configure(e),e.captureUncaught){i._rollbarOldOnError=r.onerror,r.onerror=n(i);var o,a,c="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(o=0;o<c.length;++o)a=c[o],r[a]&&r[a].prototype&&l(i,r[a].prototype)}return e.captureUnhandledRejections&&(i._unhandledRejectionHandler=function(r){var e=r.reason,o=r.promise,t=r.detail;!e&&t&&(e=t.reason,o=t.promise),i.unhandledRejection(e,o)},r.addEventListener("unhandledrejection",i._unhandledRejectionHandler)),r[t]=i,i})()},a.prototype.loadFull=function(r,e,t,n,a){var i=function(){var e;if(void 0===r._rollbarPayloadQueue){var o,t,n,i;for(e=new Error("rollbar.js did not load");o=r._rollbarShimQueue.shift();)for(n=o.args,i=0;i<n.length;++i)if(t=n[i],"function"==typeof t){t(e);break}}"function"==typeof a&&a(e)},l=!1,c=e.createElement("script"),d=e.getElementsByTagName("script")[0],p=d.parentNode;c.crossOrigin="",c.src=n.rollbarJsUrl,c.async=!t,c.onload=c.onreadystatechange=o(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){c.onload=c.onreadystatechange=null;try{p.removeChild(c)}catch(r){}l=!0,i()}}),p.insertBefore(c,d)},a.prototype.wrap=function(r,e){try{var o;if(o="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped){r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){throw e._rollbarContext=o()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e,e}},r._wrapped._isWrap=!0;for(var t in r)r.hasOwnProperty(t)&&(r._wrapped[t]=r[t])}return r._wrapped}catch(n){return r}};for(var d="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError,unhandledRejection".split(","),p=0;p<d.length;++p)a.prototype[d[p]]=i(d[p]);r.exports={Rollbar:a,_rollbarWindowOnError:t}},function(r,e){"use strict";r.exports=function(r,e){return function(o){if(!o&&!window._rollbarInitialized){var t=window.RollbarNotifier,n=e||{},a=n.globalAlias||"Rollbar",i=window.Rollbar.init(n,r);i._processShimQueue(window._rollbarShimQueue||[]),window[a]=i,window._rollbarInitialized=!0,t.processPayloads()}}}}]);
<?php echo $jsvar; ?>
</script>
<?php
}
Expand Down
6 changes: 5 additions & 1 deletion src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://cash.me/$dsifford
Tags: academia, academic, bibliographies, bibliography, citation, citations, cite, citing, CSL, curriculum vitae, cv, doi, endnote, footnote, footnotes, journal, mendeley, papers, pmid, publications, publish, pubmed, reference, reference list, reference manager, references, referencing, ris, scholar, scholarly, zotero
Requires at least: 4.2.2
Tested up to: 4.6
Stable tag: 4.4.3
Stable tag: 4.4.4
License: GPL3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -48,6 +48,10 @@ Yikes! I'm sorry about that. Please report all issues on the Academic Blogger's

== Changelog ==

= 4.4.4 =

[Click here](https://headwayapp.co/academic-bloggers-toolkit-changelog) to view changes.

= 4.4.3 =

[Click here](https://headwayapp.co/academic-bloggers-toolkit-changelog) to view changes.
Expand Down

0 comments on commit 4795a42

Please sign in to comment.