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