Changeset 36366 for trunk/src/wp-includes/class-wp-theme.php
- Timestamp:
- 01/20/2016 06:28:33 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme.php
r36250 r36366 1178 1178 * @access public 1179 1179 * 1180 * @param int $blog_id Optional. Defaults to current blog.1180 * @param int $blog_id Optional. ID of the site. Defaults to the current site. 1181 1181 * @return array Array of stylesheet names. 1182 1182 */ 1183 1183 public static function get_allowed( $blog_id = null ) { 1184 1184 /** 1185 * Filter the array of themes allowed on the site or network. 1185 * Filter the array of themes allowed on the network. 1186 * 1187 * Site is provided as context so that a list of network allowed themes can 1188 * be filtered further. 1189 * 1190 * @since 4.5.0 1191 * 1192 * @param array $allowed_themes An array of theme stylesheet names. 1193 * @param int $blog_id ID of the site. 1194 */ 1195 $network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id ); 1196 return $network + self::get_allowed_on_site( $blog_id ); 1197 } 1198 1199 /** 1200 * Returns array of stylesheet names of themes allowed on the network. 1201 * 1202 * @since 3.4.0 1203 * 1204 * @static 1205 * @access public 1206 * 1207 * @staticvar array $allowed_themes 1208 * 1209 * @return array Array of stylesheet names. 1210 */ 1211 public static function get_allowed_on_network() { 1212 static $allowed_themes; 1213 if ( ! isset( $allowed_themes ) ) { 1214 $allowed_themes = (array) get_site_option( 'allowedthemes' ); 1215 } 1216 1217 /** 1218 * Filter the array of themes allowed on the network. 1186 1219 * 1187 1220 * @since MU … … 1189 1222 * @param array $allowed_themes An array of theme stylesheet names. 1190 1223 */ 1191 $network = (array) apply_filters( 'allowed_themes', self::get_allowed_on_network() ); 1192 return $network + self::get_allowed_on_site( $blog_id ); 1193 } 1194 1195 /** 1196 * Returns array of stylesheet names of themes allowed on the network. 1224 $allowed_themes = apply_filters( 'allowed_themes', $allowed_themes ); 1225 1226 return $allowed_themes; 1227 } 1228 1229 /** 1230 * Returns array of stylesheet names of themes allowed on the site. 1197 1231 * 1198 1232 * @since 3.4.0 … … 1203 1237 * @staticvar array $allowed_themes 1204 1238 * 1205 * @return array Array of stylesheet names. 1206 */ 1207 public static function get_allowed_on_network() { 1208 static $allowed_themes; 1209 if ( ! isset( $allowed_themes ) ) 1210 $allowed_themes = (array) get_site_option( 'allowedthemes' ); 1211 return $allowed_themes; 1212 } 1213 1214 /** 1215 * Returns array of stylesheet names of themes allowed on the site. 1216 * 1217 * @since 3.4.0 1218 * 1219 * @static 1220 * @access public 1221 * 1222 * @staticvar array $allowed_themes 1223 * 1224 * @param int $blog_id Optional. Defaults to current blog. 1239 * @param int $blog_id Optional. ID of the site. Defaults to the current site. 1225 1240 * @return array Array of stylesheet names. 1226 1241 */ … … 1231 1246 $blog_id = get_current_blog_id(); 1232 1247 1233 if ( isset( $allowed_themes[ $blog_id ] ) ) 1234 return $allowed_themes[ $blog_id ]; 1248 if ( isset( $allowed_themes[ $blog_id ] ) ) { 1249 /** 1250 * Filter the array of themes allowed on the site. 1251 * 1252 * @since 4.5.0 1253 * 1254 * @param array $allowed_themes An array of theme stylesheet names. 1255 * @param int $blog_id ID of the site. Defaults to current site. 1256 */ 1257 return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); 1258 } 1235 1259 1236 1260 $current = $blog_id == get_current_blog_id(); … … 1280 1304 } 1281 1305 1282 return (array) $allowed_themes[ $blog_id ]; 1306 /** This filter is documented in wp-includes/class-wp-theme.php */ 1307 return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id ); 1283 1308 } 1284 1309
Note: See TracChangeset
for help on using the changeset viewer.