Archives works again

Very hacky method, the RC of the new Textpattern, /archives doesn’t work, it’ll get a 404 error. So instead of using the new URL, I edited my plugin to allow /archives, by not making it a 404 of course.

And you have to get the year and month from the request, if there’s a ? in it, then it’s more complicated. I used preg_match, must match the first thing. First match the year, which is 4 numbers, then make a new request string, and remove the year, then match a two digit with the new string, and you have the month and year. If you don’t remove the year, it’ll match 20 for the month.

Probably a better way to do it, if you have a brain.

            preg_match("/\d{4}/", $req, $matches);
            $year = $matches[0];
            $req2 = str_replace($year, "", $req);
            preg_match("/\d{2}/", $req2, $matches);
            $month = $matches[0];

There’s the shitty code to do it.

The plugin will probably never be released. Nobody released a WordPress importer plugin, I never finished mine. It’ll import posts, but the files importing isn’t done.

Also, there’s no settings for the plugin, what you see on this site, is all it does, “/2018/05/archives-works-again”.

Think I failed at upgrading, the CSS might be broken, uploaded it by FTP, since I failed at doing it by SSH. No difference, the CSS for the Admin panel is different, it shouldn’t be on the CDN, kind of hard for it to be. I didn’t make a plugin for that.

Why did they put the Save button in a box?

You know what else is broken? The navigation on the posts. Even the recent posts work, they changed something for the navigation, so now it’s whatever the default is. Apparently my half ass plugin isn’t good enough anymore.

Nice, the navigation doesn’t call my function anymore. If you look at Textpattern’s source code, it should be calling it.

Maybe, I’ll add the format to the database tomorrow, and change the setting. Then Textpattern can change the URL.

If you remove the return false, Textpattern doesn’t make the URL. But it doesn’t do what you want.

Update
The next and previous post works now, fixed by brute force. I’m guessing the posted variable is nothing for the navigation, and instead it’s already formated in Posted.

        if(!isset($l['Posted'])) {
            $date = strftime("%Y/%m",$l['posted']);
            $year = strftime("%Y",$l['posted']);
            $month = strftime("%m",$l['posted']);
        }
        else {
            list($year, $month, $day) = explode("-", $l['Posted']);
            $date = "$year/$month";
        }

Update
Looks like the RSS works now. Needed a default section. Actually, I don’t think that is even needed. Still works without checking the section. Probably find something broken eventually.