This is a diff against the 7.x-7.x.
This is an *extremly* ugly hack a.t.m. Excuses:
- Libraries 2 is not available with 6.x
- Libraries 2 was alpha when the modul was created and has many quirks to cope with that.
- We had to support several versions to not break other modules that made the code very complex.
- I did not test it thouroughly.
I think we need a rework/cleanup of the 7.x modul and create the backport after this is done?
Other notes: The 7.x module was written for libraries2 and libraries1 doessn't support most features of libraries2( libraries1 actually has only two functions) so some functions of libraries2 are rudimentary implemented in this module:
- libraries_detect -> xregexp_api_libraries_detect
- libraries_load -> xregexp_api_libraries_load
- libraries_get_version -> xregexp_api_libraries_get_version (cnp from libraries2)
But at least it is a preview.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | xregexp_api7.x-6.x.patch | 9.71 KB | kaidawai |
| xregexp_api7.x-6.x.patch | 8.99 KB | kaidawai |
Comments
Comment #1
kaidawai commentedHi,
now i did some additional minor testing. Fixed some obvious problems. It seems as if it at least works for some test-PCRE - even though it's still ugly( the xregexp module ).
Comment #2
attiks commented@kaidawai feel free to simplify the backport as needed with regards to libraries and feel free to commit this to the 6.x-1.x branch, I fully ttrust you ;-)
Comment #3
kaidawai commentedHi,
i allready pushed it to git. In that case i think i look into the 7.x first and clean that up and than backport as necessarry. Sunday is a good day to do that...
Comment #4
kaidawai commentedHi,
ok i now anderstand where the confusion comes from.
Snippet from libraries2 example in libraries.api.php:
---
'versions' => array(
'2.1' => array(
'files' => array(
'js' => array('tiny_mce.js'),
),
'variants' => array(
'source' => array(
'files' => array(
'js' => array('tiny_mce_src.js'),
),
),
---
Now, that is exactly how we construct the information. So you have the library with several versions(e.g. 1, 1.5, 2.0) and every version has several variants(e.g. min, small, all...).
This is how we construct the library info.
The confusing part comes in with loading. In libraries_load there ist no way to pass the version:
---
function libraries_load($name, $variant = NULL) {
---
What makes it even more confusing is that the info struct has the "default" variant of a version separate from the other variants(see snipped above).
But the way i see it now: this confusion is not caused by xregexp but is in libraries2.
I guess we have to leave it up to the user to only have one version of the library installed - actually this also makes sense: you can only use one at a time anyways. The only improvement i can imagine is to add the version to the variant so that it can be passed as $variant.
Comment #5
attiks commentedSo I think we better leave at as it is right now, we don't gain much from adding the version. We had a similar problem with the picture module, we added a condition into hook_library_info to switch libraries.
Comment #6
kaidawai commentedright. libraries2 strips everything besides the highest version anyways.
So thats how 6.x handles does it as well.
Also when i pulled the git today i found some difference to my local files(which made the module crash). Corrected that as well and pushed it to git. I Think it works now similar to the 7.x.
Comment #7
kaidawai commentedi did some further testing with a fresh pull from git.
- different versions of xregxp in the directory
- multiple variants of xregxp in the directory
- only one version in the directory(also old ones).
+ added some support for some PHP PCRE and the PHP /u flag that is not supported by XRegExp
Comment #8
kaidawai commentedlooks like it works.
Comment #9
jelle_sI added the releases on the project page ;-)