name = $name; } function __toString() { return $this->name; } } class PostType { private $id = null; private $wordpress_id = null; private $title = null; function PostType($id, $wordpress_id, $title) { $this->id = $id; $this->wordpress_id = $wordpress_id; $this->title = $title; } function __toString() { return $this->id; } function wordpress_id() { return $this->wordpress_id; } /** * @return string */ function title() { return $this->title; } static function from_query($s) { global $post_type_post, $post_type_page; switch ($s) { case $post_type_post->id: return $post_type_post; case $post_type_page->id: return $post_type_page; default: return NULL; } } static function from_wordpress($s) { global $post_type_post, $post_type_page; switch ($s) { case $post_type_post->wordpress_id: return $post_type_post; case $post_type_page->wordpress_id: return $post_type_page; default: return NULL; } } } ?>