Plugin Directory

Changeset 772574


Ignore:
Timestamp:
09/15/2013 07:40:53 AM (12 years ago)
Author:
federico_jacobi
Message:

Updated browsers regEx

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

Legend:

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

    r424603 r772574  
    55Requires at least: 2.0.2
    66Tested up to: 3.2.1
    7 Stable tag: 0.3
     7Stable tag: 0.4
    88
    99Displays different themes based on the browser used.
     
    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, iPad/iPhone/iPod, Safari, Playstation 3, 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, Chrome, Opera, iPad/iPhone/iPod, Safari, Playstation 3, 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.
    1818
    1919Thanks to Drazen Mokic, Nicholas McQuillin and Paul Gregory for their help and suggestions.
  • theme-to-browser-t2b-control/trunk/t2b.php

    r417226 r772574  
    44Plugin URI: http://www.federicojacobi.com/wp/work/t2b-control/
    55Description: 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, BlackBerries, Playstation 3
    6 Version: 0.3
     6Version: 0.4
    77Author: Federico Jacobi
    88Author URI: http://www.federicojacobi.com
     
    1010
    1111$supported_browsers = array (
    12     '|MSIE ([0-9].[0-9]{1,2})|' => array('ie','Internet Explorer'),
     12    '|MSIE ([0-9]?.[0-9]{1,2})|' => array('ie','Internet Explorer'),
    1313    '|Firefox/([0-9\.]+)|' => array('firefox','FireFox'),
    14     '|Opera/([0-9].[0-9]{1,2})|' => array('opera','Opera'),
     14    '/Opera|OPR\/(.[0-9]){1,5}/' => array('opera','Opera'),
     15
     16    '|Chrome/[0-9]{1,3}(.[0-9]{1,3}){1,5}|' => array('chrome','Chrome'),
     17
    1518    '/\(iPhone|iPod/' => array('iphone','iPhone, iPod'),
    1619    '/\(iPad/' => array('ipad','iPad'),
    17     '|Safari/([0-9\.]+)|' => array('safari','Safari'),
     20    '|Safari|' => array('safari','Safari'),
     21   
    1822    '/BlackBerry8310/' => array('blackberry8310','BlackBerry 8310'),
    1923    '/BlackBerry/' => array('blackberry','All BlackBerry'),
    2024    '/PLAYSTATION 3|PS3/' => array('ps3','Playstation 3')
    2125);
    22 $lzt_version = '0.3';
     26$lzt_version = '0.4';
    2327$useragent = $_SERVER['HTTP_USER_AGENT'];
    2428$browser_version = 0;
     
    3438
    3539$lzt_theme = get_option('lzt_'.$lzt_browser);
    36 
    37 if ($lzt_theme != "t2b_default") {
    38     // Check for a valid theme directory, and set the template and stylesheet directory
    39     if($lzt_theme && file_exists(get_theme_root() . "/$lzt_theme")) {
    40    
    41         $theme_data = get_theme_data(get_theme_root()."/$lzt_theme/style.css");
    42         if ($theme_data['Template'] == '') {
    43             $theme_parent = $lzt_theme;
    44         } else {
    45             $theme_parent = $theme_data['Template'];
     40if (! is_admin() ) {
     41    if ($lzt_theme != "t2b_default") {
     42        // Check for a valid theme directory, and set the template and stylesheet directory
     43        if($lzt_theme && file_exists(get_theme_root() . "/$lzt_theme")) {
     44       
     45            $theme_data = get_theme_data(get_theme_root()."/$lzt_theme/style.css");
     46            if ($theme_data['Template'] == '') {
     47                $theme_parent = $lzt_theme;
     48            } else {
     49                $theme_parent = $theme_data['Template'];
     50            }
     51            add_filter('template','lzt_set_theme');
     52            add_filter('stylesheet','lzt_set_css');
    4653        }
    47         add_filter('template','lzt_set_theme');
    48         add_filter('stylesheet','lzt_set_css');
    49     //  add_action('wp_footer','echoresult');   // Triggers debug at the footer
    5054    }
     55    //add_action('wp_footer','echoresult'); // Triggers debug at the footer
    5156}
    52 
    5357// Debug function ... just to make sure the right stuff is loaded
    5458function echoresult() {
    5559    global $theme_parent, $lzt_theme;
    5660    global $theme_data;
     61    global $useragent;
     62    echo "<div>";
     63    get_template();
     64    echo '|';
    5765    echo "ThemeParent:".$theme_parent."<br>";
    58     echo "ThemeCss:".$lzt_theme;   
     66    echo "ThemeCss:".$lzt_theme."<br>";
     67    echo "Useragent:". $useragent."<br>";
     68    print_r($theme_data);
     69    echo "</div>";
    5970}
    6071
     
    7384    ?>
    7485    <div class="wrap">
    75     <h2>Theme to Browser Control a.k.a. T2B (v.<?php echo $lzt_version ?>)</h2>
     86    <div id="icon-options-general" class="icon32"></div> <h2>Theme to Browser Control a.k.a. T2B (v.<?php echo $lzt_version ?>)</h2>
    7687    <?php
    7788    if ($_REQUEST['submit']) {
     
    112123                    foreach ($supported_browsers as $browser_regex => $browser_name) {
    113124                ?>
    114             <div class="postbox" style="width:200px; float:left; display: inline-block; margin: 5px;">
    115                 <h3 class="hndle"><span><?php echo $browser_name[1] ?></span></h3>
     125            <div style="width:200px; float:left; display: inline-block; margin: 5px; background-color:#F1F1F1; border:1px solid #E3E3E3; padding:5px;">
     126                <h3><?php echo $browser_name[1] ?></h4>
    116127                <div class="inside"><p><ul>
    117128                <?php
Note: See TracChangeset for help on using the changeset viewer.