« first day (2608 days earlier)      last day (2325 days later) » 

6:21 AM
As a contrary example of how to do classes right, the MO class that is the core of translation is not final and I should be able to easily extend it to return object that dynamically convert to string with the magic __tostring, and that way load and parse the translation only when they are actually required.
This is something that is notnsolvable with just an interface as an interface would have required me to fork the class and keep merging new changes into the fork
... and that was just a mental exercise. At some point I will have to try implement it and check how much memory can be saved by late binding translations, for at least some of the page loads
well, maybe composition/facade would have been good enough and there is no need for a full fork of the code of the class ....
 
 
9 hours later…
3:28 PM
Does anyone know how to sort a [ 1, 2, 3, 4, 5 ] array as [ 5, 1, 4, 2, 3 ]? The array contains objects so I can't use usort()
 
3:47 PM
lol @gmazzap now I see github.com/inpsyde/translation-cache. so I am not the only one thinking this area is problematic ;)
@JackJohansson don't remeber the name (asort ?), but one of the sorting functions can sort based on a result from a callback
 
@MarkKaplun the usort() is probably what you mean
 
oh lol, but why not?
 
I can't compare the elements since they are images
 
if you can't compare you can't sort, so something is missing in the requirements you give :)
 
I'm just trying to sort them from centre to outside, by keys :P
 
3:53 PM
still, if you as a human can define a sorting criteria then you as programer can write a callback. If you have coordinates then you sort by distance
 
4:06 PM
Is there any place on SE to ask this? This is making me crazy.
 
4:22 PM
ok turned out to be this:
$current_key = ( $key % 2 == 0 ) ? ( ( count( $array ) - ( $key / 2 ) ) - 1 ) : ( ( $key - 1 ) / 2 );
:D
Seems like I should have continued my civil eng. career
 
4:57 PM
So, strange issue here. Trying to filter includes_url. Replacing site_url() with network_site_url(). The URL isn't changing. I've tried default priority, low priority, and insanely high priority. It still isn't changing the URL. Any idea why?
 
Have you tried adding some static string to see if the issue is with network_site_url() or the filter itself?
 
I can output the original URL and the modified URL, immediately BEFORE the return statement, and it is replacing just fine. I'm returning the replaced URL and it's still not changing the URL.
The URL of includes_url() is this: $url = site_url( '/' . WPINC . '/', $scheme );
That's what's being passed to the filter hook.
 
@MichaelEcklund I usually add strings like 'test' instead of functions here, to track back the issue
each unique string to a single value to see where exactly the code is halting
 
 
2 hours later…
6:39 PM
At a complete loss here. I don't understand why it's not working.
 
 
5 hours later…
11:30 PM
wow... that's because WordPress doesn't use includes_url(); when enqueuing scripts. /sigh... ended up having to use style_loader_src and script_loader_src.
what a headache
 

« first day (2608 days earlier)      last day (2325 days later) »