| @@ 6879-6949 (lines=71) @@ | ||
| 6876 | } |
|
| 6877 | } |
|
| 6878 | } |
|
| 6879 | else { |
|
| 6880 | if ( !is_array( $pod ) ) |
|
| 6881 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 6882 | ||
| 6883 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 6884 | $meta_type = $pod[ 'type' ]; |
|
| 6885 | ||
| 6886 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 6887 | $meta_type = 'post'; |
|
| 6888 | elseif ( 'taxonomy' == $meta_type ) |
|
| 6889 | $meta_type = 'term'; |
|
| 6890 | ||
| 6891 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 6892 | ||
| 6893 | if ( !$no_conflict ) |
|
| 6894 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 6895 | ||
| 6896 | foreach ( $ids as $id ) { |
|
| 6897 | if ( 'settings' == $meta_type ) { |
|
| 6898 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 6899 | ||
| 6900 | if ( empty( $related_id ) ) |
|
| 6901 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 6902 | ||
| 6903 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 6904 | foreach ( $related_id as $related ) { |
|
| 6905 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 6906 | if ( isset( $related[ 'id' ] ) ) |
|
| 6907 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 6908 | else { |
|
| 6909 | foreach ( $related as $r ) { |
|
| 6910 | $related_ids[] = (int) $r; |
|
| 6911 | } |
|
| 6912 | } |
|
| 6913 | } |
|
| 6914 | else |
|
| 6915 | $related_ids[] = (int) $related; |
|
| 6916 | } |
|
| 6917 | } |
|
| 6918 | } |
|
| 6919 | else { |
|
| 6920 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 6921 | ||
| 6922 | if ( empty( $related_id ) ) |
|
| 6923 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 6924 | ||
| 6925 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 6926 | foreach ( $related_id as $related ) { |
|
| 6927 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 6928 | if ( isset( $related[ 'id' ] ) ) |
|
| 6929 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 6930 | else { |
|
| 6931 | foreach ( $related as $r ) { |
|
| 6932 | if ( isset( $related[ 'id' ] ) ) |
|
| 6933 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 6934 | else |
|
| 6935 | $related_ids[] = (int) $r; |
|
| 6936 | } |
|
| 6937 | } |
|
| 6938 | } |
|
| 6939 | else |
|
| 6940 | $related_ids[] = (int) $related; |
|
| 6941 | } |
|
| 6942 | } |
|
| 6943 | } |
|
| 6944 | } |
|
| 6945 | ||
| 6946 | if ( !$no_conflict ) |
|
| 6947 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 6948 | } |
|
| 6949 | } |
|
| 6950 | ||
| 6951 | if ( is_array( $related_ids ) ) { |
|
| 6952 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|
| @@ 7031-7104 (lines=74) @@ | ||
| 7028 | } |
|
| 7029 | } |
|
| 7030 | } |
|
| 7031 | else { |
|
| 7032 | // @todo handle meta-based lookups |
|
| 7033 | return false; |
|
| 7034 | ||
| 7035 | if ( !is_array( $pod ) ) |
|
| 7036 | $pod = $this->load_pod( array( 'id' => $pod_id, 'table_info' => false ), false ); |
|
| 7037 | ||
| 7038 | if ( !empty( $pod ) && in_array( $pod[ 'type' ], array( 'post_type', 'media', 'taxonomy', 'user', 'comment', 'settings' ) ) ) { |
|
| 7039 | $related_ids = array(); |
|
| 7040 | ||
| 7041 | $meta_type = $pod[ 'type' ]; |
|
| 7042 | ||
| 7043 | if ( in_array( $meta_type, array( 'post_type', 'media' ) ) ) |
|
| 7044 | $meta_type = 'post'; |
|
| 7045 | elseif ( 'taxonomy' == $meta_type ) |
|
| 7046 | $meta_type = 'term'; |
|
| 7047 | ||
| 7048 | $no_conflict = pods_no_conflict_check( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7049 | ||
| 7050 | if ( !$no_conflict ) |
|
| 7051 | pods_no_conflict_on( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7052 | ||
| 7053 | if ( 'settings' == $meta_type ) { |
|
| 7054 | $related_id = get_option( '_pods_' . $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7055 | ||
| 7056 | if ( empty( $related_id ) ) |
|
| 7057 | $related_id = get_option( $pod[ 'name' ] . '_' . $field[ 'name' ] ); |
|
| 7058 | ||
| 7059 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7060 | foreach ( $related_id as $related ) { |
|
| 7061 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7062 | if ( isset( $related[ 'id' ] ) ) |
|
| 7063 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7064 | else { |
|
| 7065 | foreach ( $related as $r ) { |
|
| 7066 | $related_ids[] = (int) $r; |
|
| 7067 | } |
|
| 7068 | } |
|
| 7069 | } |
|
| 7070 | else |
|
| 7071 | $related_ids[] = (int) $related; |
|
| 7072 | } |
|
| 7073 | } |
|
| 7074 | } |
|
| 7075 | else { |
|
| 7076 | $related_id = get_metadata( $meta_type, $id, '_pods_' . $field[ 'name' ], true ); |
|
| 7077 | ||
| 7078 | if ( empty( $related_id ) ) |
|
| 7079 | $related_id = get_metadata( $meta_type, $id, $field[ 'name' ] ); |
|
| 7080 | ||
| 7081 | if ( is_array( $related_id ) && !empty( $related_id ) ) { |
|
| 7082 | foreach ( $related_id as $related ) { |
|
| 7083 | if ( is_array( $related ) && !empty( $related ) ) { |
|
| 7084 | if ( isset( $related[ 'id' ] ) ) |
|
| 7085 | $related_ids[] = (int) $related[ 'id' ]; |
|
| 7086 | else { |
|
| 7087 | foreach ( $related as $r ) { |
|
| 7088 | if ( isset( $related[ 'id' ] ) ) |
|
| 7089 | $related_ids[] = (int) $r[ 'id' ]; |
|
| 7090 | else |
|
| 7091 | $related_ids[] = (int) $r; |
|
| 7092 | } |
|
| 7093 | } |
|
| 7094 | } |
|
| 7095 | else |
|
| 7096 | $related_ids[] = (int) $related; |
|
| 7097 | } |
|
| 7098 | } |
|
| 7099 | } |
|
| 7100 | ||
| 7101 | if ( !$no_conflict ) |
|
| 7102 | pods_no_conflict_off( ( 'term' == $meta_type ? 'taxonomy' : $meta_type ) ); |
|
| 7103 | } |
|
| 7104 | } |
|
| 7105 | ||
| 7106 | if ( is_array( $related_ids ) ) |
|
| 7107 | $related_ids = array_unique( array_filter( $related_ids ) ); |
|