| @@ 7212-7282 (lines=71) @@ | ||
| 7209 | } |
|
| 7210 | } |
|
| 7211 | } |
|
| 7212 | else { |
|
| 7213 | if ( !is_array( $pod ) ) |
|
| 7214 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7215 | ||
| 7216 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7217 | $meta_type = $pod[ 'type' ]; |
|
| 7218 | ||
| 7219 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7220 | $meta_type = 'post'; |
|
| 7221 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7222 | $meta_type = 'term'; |
|
| 7223 | ||
| 7224 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7225 | ||
| 7226 | if ( !$no_conflict ) |
|
| 7227 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7228 | ||
| 7229 | foreach ( $ids as $id ) { |
|
| 7230 | if ( 'settings' == $meta_type ) { |
|
| 7231 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7232 | ||
| 7233 | if ( empty( $related_id ) ) |
|
| 7234 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7235 | ||
| 7236 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7237 | foreach ( $related_id as $related ) { |
|
| 7238 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7239 | if ( isset( $related[ 'id' ] ) ) |
|
| 7240 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7241 | else { |
|
| 7242 | foreach ( $related as $r ) { |
|
| 7243 | $related_ids[] = (int) $r; |
|
| 7244 | } |
|
| 7245 | } |
|
| 7246 | } |
|
| 7247 | else |
|
| 7248 | $related_ids[] = (int) $related; |
|
| 7249 | } |
|
| 7250 | } |
|
| 7251 | } |
|
| 7252 | else { |
|
| 7253 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7254 | ||
| 7255 | if ( empty( $related_id ) ) |
|
| 7256 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7257 | ||
| 7258 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7259 | foreach ( $related_id as $related ) { |
|
| 7260 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7261 | if ( isset( $related[ 'id' ] ) ) |
|
| 7262 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7263 | else { |
|
| 7264 | foreach ( $related as $r ) { |
|
| 7265 | if ( isset( $related[ 'id' ] ) ) |
|
| 7266 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7267 | else |
|
| 7268 | $related_ids[] = (int) $r; |
|
| 7269 | } |
|
| 7270 | } |
|
| 7271 | } |
|
| 7272 | else |
|
| 7273 | $related_ids[] = (int) $related; |
|
| 7274 | } |
|
| 7275 | } |
|
| 7276 | } |
|
| 7277 | } |
|
| 7278 | ||
| 7279 | if ( !$no_conflict ) |
|
| 7280 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7281 | } |
|
| 7282 | } |
|
| 7283 | ||
| 7284 | if ( is_array( $related_ids ) ) { |
|
| 7285 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|
| @@ 7364-7437 (lines=74) @@ | ||
| 7361 | } |
|
| 7362 | } |
|
| 7363 | } |
|
| 7364 | else { |
|
| 7365 | // @todo handle meta-based lookups |
|
| 7366 | return false; |
|
| 7367 | ||
| 7368 | if ( !is_array( $pod ) ) |
|
| 7369 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7370 | ||
| 7371 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7372 | $related_ids = array(); |
|
| 7373 | ||
| 7374 | $meta_type = $pod[ 'type' ]; |
|
| 7375 | ||
| 7376 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7377 | $meta_type = 'post'; |
|
| 7378 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7379 | $meta_type = 'term'; |
|
| 7380 | ||
| 7381 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7382 | ||
| 7383 | if ( !$no_conflict ) |
|
| 7384 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7385 | ||
| 7386 | if ( 'settings' == $meta_type ) { |
|
| 7387 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7388 | ||
| 7389 | if ( empty( $related_id ) ) |
|
| 7390 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7391 | ||
| 7392 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7393 | foreach ( $related_id as $related ) { |
|
| 7394 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7395 | if ( isset( $related[ 'id' ] ) ) |
|
| 7396 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7397 | else { |
|
| 7398 | foreach ( $related as $r ) { |
|
| 7399 | $related_ids[] = (int) $r; |
|
| 7400 | } |
|
| 7401 | } |
|
| 7402 | } |
|
| 7403 | else |
|
| 7404 | $related_ids[] = (int) $related; |
|
| 7405 | } |
|
| 7406 | } |
|
| 7407 | } |
|
| 7408 | else { |
|
| 7409 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7410 | ||
| 7411 | if ( empty( $related_id ) ) |
|
| 7412 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7413 | ||
| 7414 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7415 | foreach ( $related_id as $related ) { |
|
| 7416 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7417 | if ( isset( $related[ 'id' ] ) ) |
|
| 7418 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7419 | else { |
|
| 7420 | foreach ( $related as $r ) { |
|
| 7421 | if ( isset( $related[ 'id' ] ) ) |
|
| 7422 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7423 | else |
|
| 7424 | $related_ids[] = (int) $r; |
|
| 7425 | } |
|
| 7426 | } |
|
| 7427 | } |
|
| 7428 | else |
|
| 7429 | $related_ids[] = (int) $related; |
|
| 7430 | } |
|
| 7431 | } |
|
| 7432 | } |
|
| 7433 | ||
| 7434 | if ( !$no_conflict ) |
|
| 7435 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7436 | } |
|
| 7437 | } |
|
| 7438 | ||
| 7439 | if ( is_array( $related_ids ) ) |
|
| 7440 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|