Skip to content
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

Fix Piwik API to be used with AngularJS JSONP callback #4560

Closed
anonymous-matomo-user opened this issue Jan 21, 2014 · 1 comment
Closed
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

Hello everyone,

Piwik API is not compatible with $http.jsonp in AngularJS.

Docs: http://docs.angularjs.org/api/ng.$http

An API call like :

`````` jsoncallback=JSON_CALLBACK```

will be transform by AngularJS as something like:

jsoncallback=angular.callbacks._0

But the Piwik API doesn't allow '.' in the jsoncallback parameter.

To fix this bug, you just have to change:


/core/DataTable/Renderer/Json.php``` (line 111)

```
#!php
if (preg_match('/^[0-9a-zA-Z_]*$/D', $jsonCallback) > 0) {
```

By:

```
#!php
if (preg_match('/^[0-9a-zA-Z_.]*$/D', $jsonCallback) > 0) {
```

It would be great :)

Thanks

Romain

Keywords: angularjs,callback,jsonp
@mattab
Copy link
Member

mattab commented Jan 21, 2014

In 96ac588: Fixes #4560: Piwik API can be used with AngularJS JSONP callback
Thanks for the report & fix!

@anonymous-matomo-user anonymous-matomo-user added this to the 2.1 - Piwik 2.1 milestone Jul 8, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants