Jump to content

Recommended Posts

Posted

Anyone know of a build in way to take the bitmasked status codes and convert them back to their names/labels?

Some of them get converted in ProcessPageEdit

I could use that as a starting point and roll my own, but was hoping there was an easier way that I'm not aware of.

Posted

Isn’t it just this?

$out = array();
foreach(Page::getStatuses() as $status=>$value) {
    if ($page->status & $value) $out[] = $status;
}
return $out;

That should return an array with all statuses set for $page, right?

  • Like 5
Posted

Actually it gets even simpler than that:

$statusLabels = $page->status(true); 

$statusLabels is an array of names/labels applicable to the page. 

  • Like 8
Posted

Wow. That is nice.

I'm storing old/new as part of an activity log module. Currently I was storing the codes, easier to just store the actual labels.

Thanks all!

Posted

Hey Ryan,

Do you mind explaining $page->status(true) a little further?

Perhaps I'm a little dense today, but I'm having trouble deciphering where to find the related code in Page.php

Posted

Ah, dev branch — of course.

Is there anything else besides that? ???   ;)   :lol:  nah, only kidding

  • Like 1
Posted

Unfortunately I'm stuck at 2.5.3 for production sites at work — at least until early May.

The current vhost clusters here only have PHP 5.3.3 available.

The minimum requirement for PW is PHP 5.3.8, but 5.3.3 still works for the master branch. That's not the case with dev.

New infrastructure is just about to be released with PHP 5.5+, and we'll be moving ASAP.

In the meantime — I suffer.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...