Changeset 8497 for trunk/wp-includes/theme.php
- Timestamp:
- 07/30/2008 06:21:14 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r8485 r8497 233 233 234 234 $stylesheet_files = array(); 235 $template_files = array(); 236 235 237 $stylesheet_dir = @ dir("$theme_root/$stylesheet"); 236 238 if ( $stylesheet_dir ) { 237 239 while ( ($file = $stylesheet_dir->read()) !== false ) { 238 if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) ) 239 $stylesheet_files[] = "$theme_loc/$stylesheet/$file"; 240 } 241 } 242 243 $template_files = array(); 240 if ( !preg_match('|^\.+$|', $file) ) { 241 if ( preg_match('|\.css$|', $file) ) 242 $stylesheet_files[] = "$theme_loc/$stylesheet/$file"; 243 elseif ( preg_match('|\.php$|', $file) ) 244 $template_files[] = "$theme_loc/$stylesheet/$file"; 245 } 246 } 247 } 248 244 249 $template_dir = @ dir("$theme_root/$template"); 245 250 if ( $template_dir ) { … … 344 349 $template = ''; 345 350 $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); 346 if ( file_exists(TEMPLATEPATH . "/{$type}.php") ) 351 if ( file_exists(STYLESHEETPATH . "/{$type}.php") ) 352 $template = STYLESHEETPATH . "/{$type}.php"; 353 elseif ( file_exists(TEMPLATEPATH . "/{$type}.php") ) 347 354 $template = TEMPLATEPATH . "/{$type}.php"; 348 355 … … 364 371 function get_category_template() { 365 372 $template = ''; 366 if ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') ) 373 if ( file_exists(STYLESHEETPATH . "/category-" . absint( get_query_var('cat') ) . '.php') ) 374 $template = STYLESHEETPATH . "/category-" . absint( get_query_var('cat') ) . '.php'; 375 elseif ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') ) 367 376 $template = TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php'; 377 elseif ( file_exists(STYLESHEETPATH . "/category.php") ) 378 $template = STYLESHEETPATH . "/category.php"; 368 379 elseif ( file_exists(TEMPLATEPATH . "/category.php") ) 369 380 $template = TEMPLATEPATH . "/category.php"; … … 374 385 function get_tag_template() { 375 386 $template = ''; 376 if ( file_exists(TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php') ) 387 if ( file_exists(STYLESHEETPATH . "/tag-" . get_query_var('tag') . '.php') ) 388 $template = STYLESHEETPATH . "/tag-" . get_query_var('tag') . '.php'; 389 elseif ( file_exists(TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php') ) 377 390 $template = TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php'; 391 elseif ( file_exists(STYLESHEETPATH . "/tag.php") ) 392 $template = STYLESHEETPATH . "/tag.php"; 378 393 elseif ( file_exists(TEMPLATEPATH . "/tag.php") ) 379 394 $template = TEMPLATEPATH . "/tag.php"; … … 386 401 $taxonomy = get_query_var('taxonomy'); 387 402 $term = get_query_var('term'); 388 if ( $taxonomy && $term && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php") ) 403 if ( $taxonomy && $term && file_exists(STYLESHEETPATH . "/taxonomy-$taxonomy-$term.php") ) 404 $template = STYLESHEETPATH . "/taxonomy-$taxonomy-$term.php"; 405 elseif ( $taxonomy && $term && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php") ) 389 406 $template = TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php"; 407 elseif ( $taxonomy && file_exists(STYLESHEETPATH . "/taxonomy-$taxonomy.php") ) 408 $template = STYLESHEETPATH . "/taxonomy-$taxonomy.php"; 390 409 elseif ( $taxonomy && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy.php") ) 391 410 $template = TEMPLATEPATH . "/taxonomy-$taxonomy.php"; 411 elseif ( file_exists(STYLESHEETPATH . "/taxonomy.php") ) 412 $template = STYLESHEETPATH . "/taxonomy.php"; 392 413 elseif ( file_exists(TEMPLATEPATH . "/taxonomy.php") ) 393 414 $template = TEMPLATEPATH . "/taxonomy.php"; … … 403 424 $template = ''; 404 425 405 if ( file_exists(TEMPLATEPATH . "/home.php") ) 426 if ( file_exists(STYLESHEETPATH . "/home.php") ) 427 $template = STYLESHEETPATH . "/home.php"; 428 elseif ( file_exists(TEMPLATEPATH . "/home.php") ) 406 429 $template = TEMPLATEPATH . "/home.php"; 430 elseif ( file_exists(STYLESHEETPATH . "/index.php") ) 431 $template = STYLESHEETPATH . "/index.php"; 407 432 elseif ( file_exists(TEMPLATEPATH . "/index.php") ) 408 433 $template = TEMPLATEPATH . "/index.php"; … … 420 445 $template = ''; 421 446 422 if ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") ) 447 if ( !empty($template) && !validate_file($template) && file_exists(STYLESHEETPATH . "/$template") ) 448 $template = STYLESHEETPATH . "/$template"; 449 elseif ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") ) 423 450 $template = TEMPLATEPATH . "/$template"; 451 elseif ( file_exists(STYLESHEETPATH . "/page.php") ) 452 $template = STYLESHEETPATH . "/page.php"; 424 453 elseif ( file_exists(TEMPLATEPATH . "/page.php") ) 425 454 $template = TEMPLATEPATH . "/page.php"; … … 456 485 457 486 function get_comments_popup_template() { 458 if ( file_exists( TEMPLATEPATH . '/comments-popup.php') ) 487 if ( file_exists( STYLESHEETPATH . '/comments-popup.php') ) 488 $template = STYLESHEETPATH . '/comments-popup.php'; 489 elseif ( file_exists( TEMPLATEPATH . '/comments-popup.php') ) 459 490 $template = TEMPLATEPATH . '/comments-popup.php'; 460 491 else
Note: See TracChangeset
for help on using the changeset viewer.