| @@ 7154-7224 (lines=71) @@ | ||
| 7151 | } |
|
| 7152 | } |
|
| 7153 | } |
|
| 7154 | else { |
|
| 7155 | if ( !is_array( $pod ) ) |
|
| 7156 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7157 | ||
| 7158 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7159 | $meta_type = $pod[ 'type' ]; |
|
| 7160 | ||
| 7161 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7162 | $meta_type = 'post'; |
|
| 7163 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7164 | $meta_type = 'term'; |
|
| 7165 | ||
| 7166 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7167 | ||
| 7168 | if ( !$no_conflict ) |
|
| 7169 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7170 | ||
| 7171 | foreach ( $ids as $id ) { |
|
| 7172 | if ( 'settings' == $meta_type ) { |
|
| 7173 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7174 | ||
| 7175 | if ( empty( $related_id ) ) |
|
| 7176 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7177 | ||
| 7178 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7179 | foreach ( $related_id as $related ) { |
|
| 7180 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7181 | if ( isset( $related[ 'id' ] ) ) |
|
| 7182 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7183 | else { |
|
| 7184 | foreach ( $related as $r ) { |
|
| 7185 | $related_ids[] = (int) $r; |
|
| 7186 | } |
|
| 7187 | } |
|
| 7188 | } |
|
| 7189 | else |
|
| 7190 | $related_ids[] = (int) $related; |
|
| 7191 | } |
|
| 7192 | } |
|
| 7193 | } |
|
| 7194 | else { |
|
| 7195 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7196 | ||
| 7197 | if ( empty( $related_id ) ) |
|
| 7198 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7199 | ||
| 7200 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7201 | foreach ( $related_id as $related ) { |
|
| 7202 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7203 | if ( isset( $related[ 'id' ] ) ) |
|
| 7204 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7205 | else { |
|
| 7206 | foreach ( $related as $r ) { |
|
| 7207 | if ( isset( $related[ 'id' ] ) ) |
|
| 7208 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7209 | else |
|
| 7210 | $related_ids[] = (int) $r; |
|
| 7211 | } |
|
| 7212 | } |
|
| 7213 | } |
|
| 7214 | else |
|
| 7215 | $related_ids[] = (int) $related; |
|
| 7216 | } |
|
| 7217 | } |
|
| 7218 | } |
|
| 7219 | } |
|
| 7220 | ||
| 7221 | if ( !$no_conflict ) |
|
| 7222 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7223 | } |
|
| 7224 | } |
|
| 7225 | ||
| 7226 | if ( is_array( $related_ids ) ) { |
|
| 7227 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|
| @@ 7306-7379 (lines=74) @@ | ||
| 7303 | } |
|
| 7304 | } |
|
| 7305 | } |
|
| 7306 | else { |
|
| 7307 | // @todo handle meta-based lookups |
|
| 7308 | return false; |
|
| 7309 | ||
| 7310 | if ( !is_array( $pod ) ) |
|
| 7311 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7312 | ||
| 7313 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7314 | $related_ids = array(); |
|
| 7315 | ||
| 7316 | $meta_type = $pod[ 'type' ]; |
|
| 7317 | ||
| 7318 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7319 | $meta_type = 'post'; |
|
| 7320 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7321 | $meta_type = 'term'; |
|
| 7322 | ||
| 7323 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7324 | ||
| 7325 | if ( !$no_conflict ) |
|
| 7326 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7327 | ||
| 7328 | if ( 'settings' == $meta_type ) { |
|
| 7329 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7330 | ||
| 7331 | if ( empty( $related_id ) ) |
|
| 7332 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7333 | ||
| 7334 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7335 | foreach ( $related_id as $related ) { |
|
| 7336 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7337 | if ( isset( $related[ 'id' ] ) ) |
|
| 7338 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7339 | else { |
|
| 7340 | foreach ( $related as $r ) { |
|
| 7341 | $related_ids[] = (int) $r; |
|
| 7342 | } |
|
| 7343 | } |
|
| 7344 | } |
|
| 7345 | else |
|
| 7346 | $related_ids[] = (int) $related; |
|
| 7347 | } |
|
| 7348 | } |
|
| 7349 | } |
|
| 7350 | else { |
|
| 7351 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7352 | ||
| 7353 | if ( empty( $related_id ) ) |
|
| 7354 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7355 | ||
| 7356 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7357 | foreach ( $related_id as $related ) { |
|
| 7358 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7359 | if ( isset( $related[ 'id' ] ) ) |
|
| 7360 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7361 | else { |
|
| 7362 | foreach ( $related as $r ) { |
|
| 7363 | if ( isset( $related[ 'id' ] ) ) |
|
| 7364 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7365 | else |
|
| 7366 | $related_ids[] = (int) $r; |
|
| 7367 | } |
|
| 7368 | } |
|
| 7369 | } |
|
| 7370 | else |
|
| 7371 | $related_ids[] = (int) $related; |
|
| 7372 | } |
|
| 7373 | } |
|
| 7374 | } |
|
| 7375 | ||
| 7376 | if ( !$no_conflict ) |
|
| 7377 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7378 | } |
|
| 7379 | } |
|
| 7380 | ||
| 7381 | if ( is_array( $related_ids ) ) |
|
| 7382 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|