@@ 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; |
@@ 1081-1129 (lines=49) @@ | ||
1078 | ',' |
|
1079 | ), $limit_types ), ',' ); |
|
1080 | ||
1081 | if ( pods_version_check( 'wp', '3.5' ) ) { |
|
1082 | $mime_types = wp_get_mime_types(); |
|
1083 | ||
1084 | if ( in_array( $limit_file_type, array( 'images', 'audio', 'video' ), true ) ) { |
|
1085 | $new_limit_types = array(); |
|
1086 | ||
1087 | foreach ( $mime_types as $type => $mime ) { |
|
1088 | if ( 0 === strpos( $mime, $limit_file_type ) ) { |
|
1089 | $type = explode( '|', $type ); |
|
1090 | ||
1091 | $new_limit_types = array_merge( $new_limit_types, $type ); |
|
1092 | } |
|
1093 | } |
|
1094 | ||
1095 | if ( ! empty( $new_limit_types ) ) { |
|
1096 | $limit_types = implode( ',', $new_limit_types ); |
|
1097 | } |
|
1098 | } elseif ( 'any' != $limit_file_type ) { |
|
1099 | $new_limit_types = array(); |
|
1100 | ||
1101 | $limit_types = explode( ',', $limit_types ); |
|
1102 | ||
1103 | foreach ( $limit_types as $k => $limit_type ) { |
|
1104 | $found = false; |
|
1105 | ||
1106 | foreach ( $mime_types as $type => $mime ) { |
|
1107 | if ( 0 === strpos( $mime, $limit_type ) ) { |
|
1108 | $type = explode( '|', $type ); |
|
1109 | ||
1110 | foreach ( $type as $t ) { |
|
1111 | if ( ! in_array( $t, $new_limit_types, true ) ) { |
|
1112 | $new_limit_types[] = $t; |
|
1113 | } |
|
1114 | } |
|
1115 | ||
1116 | $found = true; |
|
1117 | } |
|
1118 | } |
|
1119 | ||
1120 | if ( ! $found ) { |
|
1121 | $new_limit_types[] = $limit_type; |
|
1122 | } |
|
1123 | } |
|
1124 | ||
1125 | if ( ! empty( $new_limit_types ) ) { |
|
1126 | $limit_types = implode( ',', $new_limit_types ); |
|
1127 | } |
|
1128 | } |
|
1129 | } |
|
1130 | ||
1131 | $limit_types = explode( ',', $limit_types ); |
|
1132 |