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