1: <?php
2:
3: 4: 5:
6: class Papi_Option_Page extends Papi_Core_Page {
7:
8: 9: 10: 11: 12: 13:
14: protected $type = self::TYPE_OPTION;
15:
16: 17: 18: 19: 20: 21: 22:
23: public function __construct( $post_id = 0 ) {
24:
25: $this->id = 0;
26: }
27:
28: 29: 30: 31: 32: 33: 34: 35:
36: public function get_property( $slug, $child_slug = '' ) {
37: $page_type_id = str_replace( 'papi/', '', papi_get_qs( 'page' ) );
38:
39: if ( empty( $page_type_id ) ) {
40: $page_types = papi_get_all_page_types( false, null, true );
41: $property = null;
42:
43: foreach ( $page_types as $index => $page_type ) {
44: if ( $property = $page_type->get_property( $slug, $child_slug ) ) {
45: break;
46: }
47: }
48:
49: if ( is_null( $property ) ) {
50: return;
51: }
52:
53: return $property;
54: }
55:
56: $page_type = papi_get_page_type_by_id( $page_type_id );
57:
58: if ( $page_type instanceof Papi_Option_Type === false ) {
59: return;
60: }
61:
62: return $page_type->get_property( $slug, $child_slug );
63: }
64:
65: 66: 67: 68: 69:
70: public function valid() {
71: return $this->id === 0 && $this->valid_type();
72: }
73: }
74: