[wp-hackers] "The Matrix Has You" easter egg

Eric Mann eric at eam.me
Sun Oct 24 21:24:34 UTC 2010


For the sake of argument, I prefer a red bikeshed :-)

I didn't expect this much of an uproar to my initial email.  Really, I just
wanted a simple way to turn off an easter egg that might confuse some of my
needier clients - you know, the kinds of people who know how to use
one-click installers supplied by web hosts, know how to turn their computers
on and off, but still type "Facebook Login" into a Google search rather than
going directly to "facebook.com."

In actuality, Otto's original suggestion of just hooking in to
`admin_action_diff` does just about everything I need.

What I'll do is hook in, check to see if we're comparing a post to itself
and, if we are, display an error message informing the user of that fact and
directing them back to the post editor:

function prevent_matrix_easter_egg() {
    $left = empty( $_POST['left'] ) ? ( empty( $_GET['left'] ) ? '' :
$_GET['left'] ) : $_POST['left'];
    $right = empty( $_POST['right'] ) ? ( empty( $_GET['right'] ) ? '' :
$_GET['right'] ) : $_POST['right'];

    if($left == $right) {
        $redirect = get_edit_post_link( $left );
        wp_die("Error: Cannot compare a revision to itself.<br /><a href=\""
. $redirect . "\">Go Back</a>");
    }
}
add_action('admin_action_diff', 'prevent_matrix_easter_egg');

This doesn't attempt to answer the "to create easter eggs" or "not to create
easter eggs" debate that's resurfaced.  The fact of the matter is that I
personally enjoy easter eggs and, really, most people do, too.  But there
will always be one or two people completely befuddled by the cool
animations, videos, and popups that define our practical jokes.  Whenever we
create an easter egg, we should keep those people in mind and have a simple
way to turn them off.

For the capital P feature (I only mention this because someone else brought
it up) you can add a filter to turn of the feature.  Now, you can add an
action to disable the Matrix easter egg as well.  It's a bit heaver than a
`remove_action` tag, but it's still not too technical.

For the sake of argument, why don't we come up with a list of these
"additional" features that developers might need to turn off for clients,
bundle the code into a drop-in (as opposed to a plug-in), and allow
developers who need it to just deploy it on their sites?

FWIW I think the easter eggs should stay.  They make WordPress fun, add
character, and prove that we have a sense of humor as a community.

~Eric

On Sun, Oct 24, 2010 at 12:51 PM, Chip Bennett <chip at chipbennett.net> wrote:

> On Sun, Oct 24, 2010 at 2:34 PM, Steve Taylor <steve at sltaylor.co.uk>
> wrote:
> >
> > Why respond with "there's nothing that can be done" and "this
> > conversation's going nowhere"? *As if WP wasn't an open source project
> > where the community decide what happens with it? :-\*
> >
> > Because, at the end of the day: it isn't; the community doesn't decide.
>
> Some have made peace with this reality, and have figured out how to work
> within the system. Others still haven't, and continue to be frustrated by
> it.
>
> Chip
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list