Plugin Directory

Changeset 370910


Ignore:
Timestamp:
04/09/2011 02:22:30 PM (15 years ago)
Author:
federico_jacobi
Message:

0.21

Location:
theme-to-browser-t2b-control/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • theme-to-browser-t2b-control/trunk/readme.txt

    r365390 r370910  
    44Tags: themes, browser, design, control, browser control, mobile, blackberry
    55Requires at least: 2.0.2
    6 Tested up to: 3.1
     6Tested up to: 3.1.1
    77Stable tag: trunk
    88
     
    1515PLEASE vote and/or rate if it works for you or let me know if there's a fix needed at web[at]federicojacobi.com.
    1616
    17 Supported browsers for now: Internet Explorer, FireFox, Opera, iPhone/iPod, Safari, BlackBerry8310 specifically, and other BlackBerry models (non-specific). All of them modern versions, however, version specific detection will come in future upgrades of the plugin.
     17Supported browsers for now: Internet Explorer, FireFox, Opera, iPad/iPhone/iPod, Safari, BlackBerry8310 specifically, and other BlackBerry models (non-specific). All of them modern versions, however, version specific detection will come in future upgrades of the plugin.
     18
     19Thanks to Nicholas McQuillin and Paul Gregory for their help.
    1820
    1921== Installation ==
     
    2527== Frequently Asked Questions ==
    2628What browsers are detected?
    27 Internet Explorer, FireFox, Opera, iPhone/iPod, Safari, BlackBerry8310, BlackBerry
     29Internet Explorer, FireFox, Opera, iPad/iPhone/iPod, Safari, BlackBerry8310, BlackBerry
    2830
    2931What about browser versions (ie5, ie6, operamini) ?
     
    4648
    4749== Changelog ==
     50= 0.21 =
     51Child themes now supported. Important fix. iPad added to browser list.
     52
    4853= 0.2 =
    4954BlackBerry8310 and All BlackBerry models added.
     
    5358
    5459== Upgrade Notice ==
     60= 0.21 =
     61The plugin wasn't working with child themes, now it is! Important fix. iPad added to browser list.
     62
    5563= 0.2 =
    5664Non critical update. It adds support for BlackBerry phones.
  • theme-to-browser-t2b-control/trunk/t2b.php

    r365387 r370910  
    33Plugin Name: Theme to Browser (T2B) Control
    44Plugin URI: http://www.federicojacobi.com/wp/work/t2b-control/
    5 Description: Display a different theme depending on the users browser. It is perfect for a quick way out of CSS annoyances and also for customization on mobile devices. Supports: Internet Explorer, FireFox, Opera, iPhone/iPod, Safari. Now supporting BlackBerry 8310, and all BlackBerries.
    6 Version: 0.2
     5Description: Display a different theme depending on the users browser. It is perfect for a quick way out of CSS annoyances and also for customization on mobile devices. Supports: Internet Explorer, FireFox, Opera, iPhone/iPod, iPad, Safari. Now supporting BlackBerry 8310, and all BlackBerries.
     6Version: 0.21
    77Author: Federico Jacobi
    88Author URI: http://www.federicojacobi.com
     
    1414    '|Opera/([0-9].[0-9]{1,2})|' => array('opera','Opera'),
    1515    '/\(iPhone|iPod/' => array('iphone','iPhone, iPod'),
     16    '/\(iPad/' => array('ipad','iPad'),
    1617    '|Safari/([0-9\.]+)|' => array('safari','Safari'),
    1718    '/BlackBerry8310/' => array('blackberry8310','BlackBerry 8310'),
    1819    '/BlackBerry/' => array('blackberry','All BlackBerry')
    1920);
    20 $lzt_version = '0.1';
     21$lzt_version = '0.21';
    2122$useragent = $_SERVER['HTTP_USER_AGENT'];
    2223$browser_version = 0;
     
    3435// Check for a valid theme directory, and set the template and stylesheet directory
    3536if($lzt_theme && file_exists(get_theme_root() . "/$lzt_theme")) {
     37
     38    $theme_data = get_theme_data(get_theme_root()."/$lzt_theme/style.css");
     39    if ($theme_data['Template'] == '') {
     40        $theme_parent = $lzt_theme;
     41    } else {
     42        $theme_parent = $theme_data['Template'];
     43    }
    3644    add_filter('template','lzt_set_theme');
    37     add_filter('stylesheet','lzt_set_theme');
     45    add_filter('stylesheet','lzt_set_css');
     46//  add_action('wp_footer','echoresult');   // Triggers debug at the footer
     47}
     48
     49// Debug function ... just to make sure the right stuff is loaded
     50function echoresult() {
     51    global $theme_parent, $lzt_theme;
     52    global $theme_data;
     53    echo "ThemeParent:".$theme_parent."<br>";
     54    echo "ThemeCss:".$lzt_theme;   
     55}
     56
     57
     58function lzt_set_theme() {
     59    global $theme_parent;
     60    return $theme_parent;
     61}
     62function lzt_set_css() {
     63    global $lzt_theme;
     64    return $lzt_theme;
    3865}
    3966
     
    88115                    foreach($themes as $theme) {
    89116                ?>
    90                 <input type="radio" name="<?php echo $browser_name[0]?>" value="<?php echo $theme['Template']; ?>" <?php
     117                <input type="radio" name="<?php echo $browser_name[0]?>" value="<?php echo $theme['Stylesheet']; ?>" <?php
    91118                    // IF este es el seleccionado THEN echo SELECTED
    92                     if ((get_option('lzt_'.$browser_name[0]) == $theme['Template']) || ($first)) {
     119                    if ((get_option('lzt_'.$browser_name[0]) == $theme['Stylesheet']) || ($first)) {
    93120                        echo 'checked="checked"';
    94121                        $first = false;
     
    134161}
    135162
    136 function lzt_set_theme($themename) {
    137     global $lzt_theme;
    138     return $lzt_theme;
    139 }
    140 
    141163
    142164add_action('admin_menu','lzt_modify_menu');
Note: See TracChangeset for help on using the changeset viewer.