| @@ 7121-7191 (lines=71) @@ | ||
| 7118 | } |
|
| 7119 | } |
|
| 7120 | } |
|
| 7121 | else { |
|
| 7122 | if ( !is_array( $pod ) ) |
|
| 7123 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7124 | ||
| 7125 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7126 | $meta_type = $pod[ 'type' ]; |
|
| 7127 | ||
| 7128 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7129 | $meta_type = 'post'; |
|
| 7130 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7131 | $meta_type = 'term'; |
|
| 7132 | ||
| 7133 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7134 | ||
| 7135 | if ( !$no_conflict ) |
|
| 7136 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7137 | ||
| 7138 | foreach ( $ids as $id ) { |
|
| 7139 | if ( 'settings' == $meta_type ) { |
|
| 7140 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7141 | ||
| 7142 | if ( empty( $related_id ) ) |
|
| 7143 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7144 | ||
| 7145 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7146 | foreach ( $related_id as $related ) { |
|
| 7147 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7148 | if ( isset( $related[ 'id' ] ) ) |
|
| 7149 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7150 | else { |
|
| 7151 | foreach ( $related as $r ) { |
|
| 7152 | $related_ids[] = (int) $r; |
|
| 7153 | } |
|
| 7154 | } |
|
| 7155 | } |
|
| 7156 | else |
|
| 7157 | $related_ids[] = (int) $related; |
|
| 7158 | } |
|
| 7159 | } |
|
| 7160 | } |
|
| 7161 | else { |
|
| 7162 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7163 | ||
| 7164 | if ( empty( $related_id ) ) |
|
| 7165 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7166 | ||
| 7167 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7168 | foreach ( $related_id as $related ) { |
|
| 7169 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7170 | if ( isset( $related[ 'id' ] ) ) |
|
| 7171 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7172 | else { |
|
| 7173 | foreach ( $related as $r ) { |
|
| 7174 | if ( isset( $related[ 'id' ] ) ) |
|
| 7175 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7176 | else |
|
| 7177 | $related_ids[] = (int) $r; |
|
| 7178 | } |
|
| 7179 | } |
|
| 7180 | } |
|
| 7181 | else |
|
| 7182 | $related_ids[] = (int) $related; |
|
| 7183 | } |
|
| 7184 | } |
|
| 7185 | } |
|
| 7186 | } |
|
| 7187 | ||
| 7188 | if ( !$no_conflict ) |
|
| 7189 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7190 | } |
|
| 7191 | } |
|
| 7192 | ||
| 7193 | if ( is_array( $related_ids ) ) { |
|
| 7194 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|
| @@ 7273-7346 (lines=74) @@ | ||
| 7270 | } |
|
| 7271 | } |
|
| 7272 | } |
|
| 7273 | else { |
|
| 7274 | // @todo handle meta-based lookups |
|
| 7275 | return false; |
|
| 7276 | ||
| 7277 | if ( !is_array( $pod ) ) |
|
| 7278 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7279 | ||
| 7280 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7281 | $related_ids = array(); |
|
| 7282 | ||
| 7283 | $meta_type = $pod[ 'type' ]; |
|
| 7284 | ||
| 7285 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7286 | $meta_type = 'post'; |
|
| 7287 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7288 | $meta_type = 'term'; |
|
| 7289 | ||
| 7290 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7291 | ||
| 7292 | if ( !$no_conflict ) |
|
| 7293 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7294 | ||
| 7295 | if ( 'settings' == $meta_type ) { |
|
| 7296 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7297 | ||
| 7298 | if ( empty( $related_id ) ) |
|
| 7299 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7300 | ||
| 7301 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7302 | foreach ( $related_id as $related ) { |
|
| 7303 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7304 | if ( isset( $related[ 'id' ] ) ) |
|
| 7305 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7306 | else { |
|
| 7307 | foreach ( $related as $r ) { |
|
| 7308 | $related_ids[] = (int) $r; |
|
| 7309 | } |
|
| 7310 | } |
|
| 7311 | } |
|
| 7312 | else |
|
| 7313 | $related_ids[] = (int) $related; |
|
| 7314 | } |
|
| 7315 | } |
|
| 7316 | } |
|
| 7317 | else { |
|
| 7318 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7319 | ||
| 7320 | if ( empty( $related_id ) ) |
|
| 7321 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7322 | ||
| 7323 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7324 | foreach ( $related_id as $related ) { |
|
| 7325 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7326 | if ( isset( $related[ 'id' ] ) ) |
|
| 7327 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7328 | else { |
|
| 7329 | foreach ( $related as $r ) { |
|
| 7330 | if ( isset( $related[ 'id' ] ) ) |
|
| 7331 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7332 | else |
|
| 7333 | $related_ids[] = (int) $r; |
|
| 7334 | } |
|
| 7335 | } |
|
| 7336 | } |
|
| 7337 | else |
|
| 7338 | $related_ids[] = (int) $related; |
|
| 7339 | } |
|
| 7340 | } |
|
| 7341 | } |
|
| 7342 | ||
| 7343 | if ( !$no_conflict ) |
|
| 7344 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7345 | } |
|
| 7346 | } |
|
| 7347 | ||
| 7348 | if ( is_array( $related_ids ) ) |
|
| 7349 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|