| @@ 76-121 (lines=46) @@ | ||
| 73 | ||
| 74 | $limit_types = trim( str_replace( array( ' ', '.', "\n", "\t", ';' ), array( '', ',', ',', ',' ), $limit_types ), ',' ); |
|
| 75 | ||
| 76 | if ( pods_version_check( 'wp', '3.5' ) ) { |
|
| 77 | $mime_types = wp_get_mime_types(); |
|
| 78 | ||
| 79 | if ( in_array( $limit_file_type, array( 'images', 'audio', 'video' ) ) ) { |
|
| 80 | $new_limit_types = array(); |
|
| 81 | ||
| 82 | foreach ( $mime_types as $type => $mime ) { |
|
| 83 | if ( 0 === strpos( $mime, $limit_file_type ) ) { |
|
| 84 | $type = explode( '|', $type ); |
|
| 85 | ||
| 86 | $new_limit_types = array_merge( $new_limit_types, $type ); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | if ( !empty( $new_limit_types ) ) |
|
| 91 | $limit_types = implode( ',', $new_limit_types ); |
|
| 92 | } |
|
| 93 | elseif ( 'any' != $limit_file_type ) { |
|
| 94 | $new_limit_types = array(); |
|
| 95 | ||
| 96 | $limit_types = explode( ',', $limit_types ); |
|
| 97 | ||
| 98 | foreach ( $limit_types as $k => $limit_type ) { |
|
| 99 | $found = false; |
|
| 100 | ||
| 101 | foreach ( $mime_types as $type => $mime ) { |
|
| 102 | if ( 0 === strpos( $mime, $limit_type ) ) { |
|
| 103 | $type = explode( '|', $type ); |
|
| 104 | ||
| 105 | foreach ( $type as $t ) { |
|
| 106 | if ( !in_array( $t, $new_limit_types ) ) |
|
| 107 | $new_limit_types[] = $t; |
|
| 108 | } |
|
| 109 | ||
| 110 | $found = true; |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | if ( !$found ) |
|
| 115 | $new_limit_types[] = $limit_type; |
|
| 116 | } |
|
| 117 | ||
| 118 | if ( !empty( $new_limit_types ) ) |
|
| 119 | $limit_types = implode( ',', $new_limit_types ); |
|
| 120 | } |
|
| 121 | } |
|
| 122 | ||
| 123 | if ( !empty( $limit_types ) ) |
|
| 124 | $plupload_init[ 'filters' ][ 0 ][ 'extensions' ] = $limit_types; |
|
| @@ 826-871 (lines=46) @@ | ||
| 823 | ||
| 824 | $limit_types = trim( str_replace( array( ' ', '.', "\n", "\t", ';' ), array( '', ',', ',', ',' ), $limit_types ), ',' ); |
|
| 825 | ||
| 826 | if ( pods_version_check( 'wp', '3.5' ) ) { |
|
| 827 | $mime_types = wp_get_mime_types(); |
|
| 828 | ||
| 829 | if ( in_array( $limit_file_type, array( 'images', 'audio', 'video' ) ) ) { |
|
| 830 | $new_limit_types = array(); |
|
| 831 | ||
| 832 | foreach ( $mime_types as $type => $mime ) { |
|
| 833 | if ( 0 === strpos( $mime, $limit_file_type ) ) { |
|
| 834 | $type = explode( '|', $type ); |
|
| 835 | ||
| 836 | $new_limit_types = array_merge( $new_limit_types, $type ); |
|
| 837 | } |
|
| 838 | } |
|
| 839 | ||
| 840 | if ( !empty( $new_limit_types ) ) |
|
| 841 | $limit_types = implode( ',', $new_limit_types ); |
|
| 842 | } |
|
| 843 | elseif ( 'any' != $limit_file_type ) { |
|
| 844 | $new_limit_types = array(); |
|
| 845 | ||
| 846 | $limit_types = explode( ',', $limit_types ); |
|
| 847 | ||
| 848 | foreach ( $limit_types as $k => $limit_type ) { |
|
| 849 | $found = false; |
|
| 850 | ||
| 851 | foreach ( $mime_types as $type => $mime ) { |
|
| 852 | if ( 0 === strpos( $mime, $limit_type ) ) { |
|
| 853 | $type = explode( '|', $type ); |
|
| 854 | ||
| 855 | foreach ( $type as $t ) { |
|
| 856 | if ( !in_array( $t, $new_limit_types ) ) |
|
| 857 | $new_limit_types[] = $t; |
|
| 858 | } |
|
| 859 | ||
| 860 | $found = true; |
|
| 861 | } |
|
| 862 | } |
|
| 863 | ||
| 864 | if ( !$found ) |
|
| 865 | $new_limit_types[] = $limit_type; |
|
| 866 | } |
|
| 867 | ||
| 868 | if ( !empty( $new_limit_types ) ) |
|
| 869 | $limit_types = implode( ',', $new_limit_types ); |
|
| 870 | } |
|
| 871 | } |
|
| 872 | ||
| 873 | $limit_types = explode( ',', $limit_types ); |
|
| 874 | ||