Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Arantor
691
The Pub / Re: Print Page
« on May 13th, 2013, 12:16 AM »
Just to add, here's the complete list of types of bbc that could be applied and this information is now available to the bbc parser in case a hook or similar wants to modify it.
Quote
*  -- agreement
 *  -- custom-field
 *  -- cut (used with westr::cut)
 *  -- empty-test (for when checking a post is really empty)
 *  -- infraction-notice
 *  -- media-album-description
 *  -- media-comment
 *  -- media-custom-field
 *  -- media-custom-field-description
 *  -- media-description
 *  -- media-embed
 *  -- media-playlist-description-preview
 *  -- media-playlist-description
 *  -- media-welcome
 *  -- mod-comment (comments to reported posts)
 *  -- mod-note (notes in the moderation center)
 *  -- news
 *  -- plugin-readme
 *  -- pm
 *  -- pm-draft
 *  -- pm-notify
 *  -- poll-option
 *  -- poll-question
 *  -- post
 *  -- post-convert (only for WYSIWYG BBC/HTML conversion)
 *  -- post-draft
 *  -- post-feed
 *  -- post-preview (for thread shortened versions of posts)
 *  -- post-notify
 *  -- preview (for previewing posts in editing)
 *  -- preview-pm (for previewing PMs before sending)
 *  -- q-and-a
 *  -- report-media
 *  -- report-post
 *  -- signature
 *  -- thought
* Arantor doesn't know why he used - instead of _ but it just seemed more readable somehow (and I suppose a subtle indication that it isn't code directly but an identifier)
692
Off-topic / Re: json_decode transforms dot in comma
« on May 12th, 2013, 10:24 PM »
Yup, that makes sense, ideally only use what you need to convert. Interestingly, Wedge only calls setlocale on LC_TIME too, principally because we do our own number formatting, though perhaps we should reconsider that too ;)
693
Off-topic / Re: json_decode transforms dot in comma
« on May 12th, 2013, 10:18 PM »
I'd suggest setlocale(LC_NUMERIC, 'en_US.UTF-8');

Be careful with the trailing definition of charset, .utf8 is often suggested in preference to .UTF-8 and you can specify multiple types.
694
The Pub / Re: Print Page
« on May 12th, 2013, 05:06 PM »
Just to add, I've already started on the refactoring, the signature for parse_bbc is now two parameters, the message and an array of options.

The array has the current following keys:
Quote
* - smileys (bool) Whether smileys should be parsed or not, regardless of any other bbcode content.
 * - cache (string) If potentially cacheable, this should be the cache's id. If not defined, no caching will occur. This should be a quasi-unique key for the item being parsed, so that if it took over 0.05 seconds, it can be cached. (The final key used for the cache takes the supplied key and includes details such as the user's locale and time offsets, an MD5 digest of the message and other details that potentially affect the way parsing occurs)
 * - print (bool) Whether in the printable mode or not, which disables various tags as well as hiding smileys.
 * - parse_tags (array) A list of tags to be parsed on this run, undefined or empty array to do all those currently enabled. (This overrides any user settings for what is and is not allowed. Additionally, runs with this set are never cached, regardless of cache id being set)
 * - owner (int) If defined, the user id of the author of this content. Used for identifying whether parsing should include user sanctions like disemvowelling.
 * - type (string, required) Indicates what type of content this is. Known values: post, signature
I should add, type is growing as I delineate each of the places parse_bbc is called, the reason for doing so is that it actually adds options to do so. Most of the time it won't make any difference but it does mean we can do things like explicitly know that a piece of bbc is a post or a signature without having to sniff the cache id. It also separates 'print page' from the smileys parameter.
695
The Pub / Re: Print Page
« on May 12th, 2013, 04:28 PM »
So, the new warning system is in place, my original concern was over the disemvowel feature.

I still want to do the refactoring, and I still think it would be an improvement to pull print page into a plugin. (The refactoring gets much simpler if I don't have to worry about print page, but I can still do it to include that for now.)

Thoughts?
696
Bug reports / Re: Infraction bugs
« on May 12th, 2013, 04:16 PM »
Quote
I guess it's related to giving the user ID to parse_bbc beforehand..?
Yup.
Quote
Well, no reason not to do both
I already refactored the disemvowel code to not duplicate all the tag handling between 'disemvowel' and 'scramble' but I'm not entirely happy yet with it.
697
Off-topic / Re: json_decode transforms dot in comma
« on May 12th, 2013, 04:15 PM »
Yay for locale settings!

json_encode/json_decode takes the floats as encoded into the JSON and converts them to your locale settings which IIRC will use commas rather than periods in Italian.

http://php.net/setlocale has a little bit more.
698
Bug reports / Re: Infraction bugs
« on May 12th, 2013, 03:52 PM »
Quote
Tried disemvowelling (sp?) posts from a test account locally.
One post just said "No idea."
As a result, the post was "N d."
Not very readable, actually...
That's essentially an edge case.
Quote
Also, a bigger bug I'd say: if I go through /profile/test-account/, and click Show posts, there they are... All of his posts, untouched.
Oh, yes, that needs to be handled.
Quote
(I just noticed that 'disemvowel' was a play on 'disembowel', ah ah...
I didn't coin the term, but it's cute.
Quote
So... This is my personal take on it: (in Subs-BBC)
Why can't we have both? If that looks like what I think it looks like[1] then hell yes. Let's do both!
 1. ...which is shuffling everything except the first and last letters...
699
Archived fixes / Re: 'Like' Disappears When Clicked
« on May 11th, 2013, 08:24 PM »
Really up to you.

* Arantor 's brain is all tired having spent hours going through bank account information for accounting purposes >_<
700
Archived fixes / Re: 'Like' Disappears When Clicked
« on May 11th, 2013, 06:28 PM »
That's less readable than mine but since you're insistent on a one liner, go with your first choice.
701
Archived fixes / Re: 'Like' Disappears When Clicked
« on May 11th, 2013, 02:05 PM »
I like code that explains what it's doing. echo'ing the result of a function that should almost always be a void function is not particularly self-explanatory.
702
Off-topic / Re: Doctor Who
« on May 11th, 2013, 05:12 AM »
So, I got around to watching the Crimson Horror.

It's what DW did best, horror with a touch of humour. And the callback to Tegan ("I spent a long time trying to get a stroppy Australian back to Heathrow Apriport") made me laugh as well as Strax being, well, Strax. ("Horse, you have failed in your mission!" "Do you have any final words before your summary execution... usual story. That's the fourth this week, and I'm not even hungry.")[1] and as for Thomas Thomas reciting the directions like a satnav.[2]

And actually, I think a spinoff with Madame Vastra and Jenny would work really well. The SJ Adventures was supposed to be a for-kids version and it didn't really have a lot going for it beyond that, though I did watch a couple (like Death of the Doctor, that was pretty good), and Torchwood was good to start with but went downhill after they kill Owen and Tosh in season 2. Once they started to get dark and cynical and too drama heavy with season length arcs (i.e. CoE and even more lamentably MD) it lost what made it Torchwood.
 1. No doubt a reference to the horsemeat scandal.
 2. TomTom is a major brand of satnav here.
703
Yeah, I've seen this but never been able to figure out why it's not consistent in reproduction :(
704
Archived fixes / Re: 'Like' Disappears When Clicked
« on May 11th, 2013, 12:34 AM »
I submit http://codepad.org/JLJdxQBI as evidence.

Code: [Select]
<?php

function test()
{
  echo 
'test';
}

$var test();
var_dump($var);

$var is null. If you have a void function, the result of assignment of function result returns null, rather than null.

That way whether the function outputs something and has no return, or returns a value, it's covered either way.
705
Features / Re: Pruning old PMs
« on May 10th, 2013, 11:42 PM »
I'm already pissed. I'm not pissed off, there's the difference :P

I will note it's already on my todo list with a note of 'proposed, initial feeling positive' so at some point I'll do it. But I'm noodling around with the editor changes I've posted about - because I do actually want to give people the ability to drag items around and make new ones and stuff because it's regularly requested but I'm taking it slowly, because I'm psyching myself up for the RL paperwork I need to do tomorrow (annual governmental report filling in, pages and pages of reporting)