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
Link to country flags does not work correctly when embedding Piwik in PHP site #5674
Comments
Is it as simple as changing it to use an absolute path? e.g., ``` |
Attachment: updated patch |
vipsoft, can you please confirm that you have tested the patch with the use case meglio mentionned? thanks |
Yes, tested before (i.e., got “xx.png”) and after (e.g., getting “us.png”). |
Attachment: test file |
vipsoft, instead of dirname(FILE) we could use PIWIK_INCLUDE_PATH right? |
I was thinking there might be a corner case that failed where PIWIK_INCLUDE_PATH was a relative path, but I just tested that scenario manually and it worked correctly. So yeah, use PIWIK_INCLUDE_PATH instead, e.g., ``` I’ll see if I can add a test case. |
Attachment: |
Perfect vipsoft: it’s a very good reflex to add test cases, or update existing test files. Fixed in 881 |
matt: please revert this patch; I broke the flag icons on the UI where it expects Piwik_getFlagFromCode() to return a relative path to the image file |
Attachment: Patch against svn |
Matt: this patch can be committed too |
committed in 885 |
I have embedded Piwik to my PHP site and I’m calling Piwik from PHP code directly.
In the code Piwik checks whether file exists:
```
function Piwik_getFlagFromCode($code)
{
$path = ‘plugins/UserCountry/flags/%s.png’;
$normalPath = sprintf($path,$code);
// flags not in the package !
if(!file_exists($normalPath))
{
return sprintf($path, ‘xx’);
}
return $normalPath;
}
```
The PHP file where I’m calling Piwik locates in different folder. Really flag file exists but this function can’t locate it and returns ‘xx’ value.
I have solved this problem just by commenting IF section. But you have to invent something to make it more intelligent.
Thanks,
Anton Andriyevskyy
Keywords: flag flags country countries
The text was updated successfully, but these errors were encountered: