| @@ 7066-7136 (lines=71) @@ | ||
| 7063 | } |
|
| 7064 | } |
|
| 7065 | } |
|
| 7066 | else { |
|
| 7067 | if ( !is_array( $pod ) ) |
|
| 7068 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7069 | ||
| 7070 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7071 | $meta_type = $pod[ 'type' ]; |
|
| 7072 | ||
| 7073 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7074 | $meta_type = 'post'; |
|
| 7075 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7076 | $meta_type = 'term'; |
|
| 7077 | ||
| 7078 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7079 | ||
| 7080 | if ( !$no_conflict ) |
|
| 7081 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7082 | ||
| 7083 | foreach ( $ids as $id ) { |
|
| 7084 | if ( 'settings' == $meta_type ) { |
|
| 7085 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7086 | ||
| 7087 | if ( empty( $related_id ) ) |
|
| 7088 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7089 | ||
| 7090 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7091 | foreach ( $related_id as $related ) { |
|
| 7092 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7093 | if ( isset( $related[ 'id' ] ) ) |
|
| 7094 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7095 | else { |
|
| 7096 | foreach ( $related as $r ) { |
|
| 7097 | $related_ids[] = (int) $r; |
|
| 7098 | } |
|
| 7099 | } |
|
| 7100 | } |
|
| 7101 | else |
|
| 7102 | $related_ids[] = (int) $related; |
|
| 7103 | } |
|
| 7104 | } |
|
| 7105 | } |
|
| 7106 | else { |
|
| 7107 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7108 | ||
| 7109 | if ( empty( $related_id ) ) |
|
| 7110 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7111 | ||
| 7112 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7113 | foreach ( $related_id as $related ) { |
|
| 7114 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7115 | if ( isset( $related[ 'id' ] ) ) |
|
| 7116 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7117 | else { |
|
| 7118 | foreach ( $related as $r ) { |
|
| 7119 | if ( isset( $related[ 'id' ] ) ) |
|
| 7120 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7121 | else |
|
| 7122 | $related_ids[] = (int) $r; |
|
| 7123 | } |
|
| 7124 | } |
|
| 7125 | } |
|
| 7126 | else |
|
| 7127 | $related_ids[] = (int) $related; |
|
| 7128 | } |
|
| 7129 | } |
|
| 7130 | } |
|
| 7131 | } |
|
| 7132 | ||
| 7133 | if ( !$no_conflict ) |
|
| 7134 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7135 | } |
|
| 7136 | } |
|
| 7137 | ||
| 7138 | if ( is_array( $related_ids ) ) { |
|
| 7139 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|
| @@ 7218-7291 (lines=74) @@ | ||
| 7215 | } |
|
| 7216 | } |
|
| 7217 | } |
|
| 7218 | else { |
|
| 7219 | // @todo handle meta-based lookups |
|
| 7220 | return false; |
|
| 7221 | ||
| 7222 | if ( !is_array( $pod ) ) |
|
| 7223 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7224 | ||
| 7225 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7226 | $related_ids = array(); |
|
| 7227 | ||
| 7228 | $meta_type = $pod[ 'type' ]; |
|
| 7229 | ||
| 7230 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7231 | $meta_type = 'post'; |
|
| 7232 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7233 | $meta_type = 'term'; |
|
| 7234 | ||
| 7235 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7236 | ||
| 7237 | if ( !$no_conflict ) |
|
| 7238 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7239 | ||
| 7240 | if ( 'settings' == $meta_type ) { |
|
| 7241 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7242 | ||
| 7243 | if ( empty( $related_id ) ) |
|
| 7244 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7245 | ||
| 7246 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7247 | foreach ( $related_id as $related ) { |
|
| 7248 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7249 | if ( isset( $related[ 'id' ] ) ) |
|
| 7250 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7251 | else { |
|
| 7252 | foreach ( $related as $r ) { |
|
| 7253 | $related_ids[] = (int) $r; |
|
| 7254 | } |
|
| 7255 | } |
|
| 7256 | } |
|
| 7257 | else |
|
| 7258 | $related_ids[] = (int) $related; |
|
| 7259 | } |
|
| 7260 | } |
|
| 7261 | } |
|
| 7262 | else { |
|
| 7263 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7264 | ||
| 7265 | if ( empty( $related_id ) ) |
|
| 7266 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7267 | ||
| 7268 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7269 | foreach ( $related_id as $related ) { |
|
| 7270 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7271 | if ( isset( $related[ 'id' ] ) ) |
|
| 7272 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7273 | else { |
|
| 7274 | foreach ( $related as $r ) { |
|
| 7275 | if ( isset( $related[ 'id' ] ) ) |
|
| 7276 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7277 | else |
|
| 7278 | $related_ids[] = (int) $r; |
|
| 7279 | } |
|
| 7280 | } |
|
| 7281 | } |
|
| 7282 | else |
|
| 7283 | $related_ids[] = (int) $related; |
|
| 7284 | } |
|
| 7285 | } |
|
| 7286 | } |
|
| 7287 | ||
| 7288 | if ( !$no_conflict ) |
|
| 7289 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7290 | } |
|
| 7291 | } |
|
| 7292 | ||
| 7293 | if ( is_array( $related_ids ) ) |
|
| 7294 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|