Changeset 930

Show
Ignore:
Timestamp:
03/06/08 18:33:25 (9 months ago)
Author:
_ck_
Message:

fixes for 0.8.4 while remaining backwards compatible

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bbpress-theme-switcher/trunk/bb-theme-switcher.php

    r878 r930  
    44Plugin URI: http://bbpress.org/plugins/topic/70 
    55Description: Allows your members and guests to switch between themes. Optional timer to return to default theme. 
    6 Version: 1.10 
     6Version: 1.14 
    77Author: _ck_ 
    88Author URI:  http://bbshowcase.org 
     
    7676        $theme = bb_ts_get_theme();  
    7777        if (empty($theme)) {return $uri;} 
    78         $active_uri=bb_get_theme_uri(bb_get_one_theme($theme));  
     78        $theme=bb_get_one_theme($theme);         
     79        $active_uri=""; 
     80        if ( 0 === strpos($theme, BBTHEMEDIR) ) 
     81                $active_uri = BBTHEMEURL . substr($theme, strlen(BBTHEMEDIR)); 
     82        elseif ( 0 === strpos($theme, BBPATH) ) 
     83                $active_uri = bb_get_option( 'uri' ) . substr($theme, strlen(BBPATH)); 
    7984        if ($active_uri) {return $active_uri;} else {return $uri;} 
    8085} 
    8186 
    8287function bb_get_one_theme($theme) { 
    83         $themes = bb_get_all_themes(); 
     88        $themes = bb_get_all_themes();   
     89        // print " <!-- "; print bb_get_option( 'uri' ).'/'.str_replace(BBPATH,'',$themes[$theme]); print BBPATH.' - '.$themes[$theme]; print " --> ";  // diagnostic 
    8490        if (array_key_exists($theme, $themes)) {return $themes[$theme];}         
    8591        return NULL; 
     
    121127 
    122128 
    123 function bb_theme_switcher($style = "text") { global $bbhash; 
     129function bb_theme_switcher($style = "text") {  
     130        global $bbhash; 
    124131        $themes = bb_get_all_themes(); 
    125  
    126         $default_theme = array_search(bb_get_option('bb_active_theme'),$themes);  //  get_current_theme(); 
    127  
     132         
     133        $default_theme=str_replace(array('core#', 'user#'),'', bb_get_option('bb_active_theme')); 
     134        if (!array_key_exists($default_theme, $themes)) {$default_theme =array_search($default_theme,$themes);} 
     135                 
    128136        if (count($themes) > 1) { 
    129137                $theme_names = array_keys($themes); 
  • bbpress-theme-switcher/trunk/readme.txt

    r878 r930  
    6363* enhanced to return to original location after theme switch instead of front page, also small bug fixes/tweaks 
    6464 
     65= Version 1.14 (2008-3-06) = 
     66 
     67* update to match theme method in 0.8.4 while remaining backward compatible with 0.8.3