Ejemplo n.º 1
0
function createFT($ua, $match, $title, $prefix = '', $note = '')
{
    print "<table class=\"zebra-striped span9\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>" . $title . "</th>\n\t\t\t\t\t<th>Your Browser</th>\n\t\t\t\t\t<th>Detector Profile</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>";
    $check = 0;
    foreach ($ua as $key => $value) {
        if (preg_match($match, $key)) {
            $check = 1;
            if (is_object($value)) {
                $value_a = (array) $value;
                ksort($value_a);
                $value = (object) $value_a;
                foreach ($value as $vkey => $vvalue) {
                    print "<tr>";
                    print "<th class=\"span7\">" . $key . "->" . $vkey . ":</th>";
                    if (Detector::$foundIn == "archive") {
                        print "<td class=\"span1\"><span class='label'>N/A</span></td>";
                    } else {
                        print "<td class=\"span1\">\n\t\t\t\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\tif (Modernizr['" . $prefix . $key . "']['" . $vkey . "'] == true) { \n\t\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label success'>\"+Modernizr['" . $prefix . $key . "']['" . $vkey . "']+\"</span>\"); \n\t\t\t\t\t\t\t\t\t\t} else if (Modernizr['" . $prefix . $key . "']['" . $vkey . "']) {\n\t\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label warning'>\"+Modernizr['" . $prefix . $key . "']['" . $vkey . "']+\"</span>\"); \n\t\t\t\t\t\t\t\t\t\t} else { \n\t\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label important'>false</span>\"); \n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t\t   </td>";
                    }
                    print "<td class=\"span1\">" . convertTF($vvalue) . "</td>";
                    print "</tr>";
                }
            } else {
                print "<tr>";
                print "<th class=\"span7\">" . $key . ":</th>";
                if (Detector::$foundIn == "archive" || $key == "extendedVersion") {
                    print "<td class=\"span1\"><span class='label'>N/A</span></td>";
                } else {
                    print "<td class=\"span1\">\n\t\t\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t";
                    if ($prefix == "core-" && $key == "mediaqueries") {
                        print "\t\tif (Modernizr['mediaqueries']) { \n\t\t\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label success'>\"+Modernizr['mediaqueries']+\"</span>\");";
                    } else {
                        print "\t\tif (Modernizr['" . $prefix . $key . "']) { \n\t\t\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label success'>\"+Modernizr['" . $prefix . $key . "']+\"</span>\");";
                    }
                    print "\t\t} else { \n\t\t\t\t\t\t\t\t\t\tdocument.write(\"<span class='label important'>false</span>\"); \n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t   </td>";
                }
                print "<td class=\"span1\">" . convertTF($value) . "</td>";
                print "</tr>";
            }
        }
    }
    if ($check == 0) {
        print "<tr>";
        print "<td class=\"span9\" colspan=\"3\">Detector wasn't able to capture these features because they rely on a cookie that was set after the PHP script ran.</td>";
        print "</tr>";
    }
    print "</tbody>";
    print "</table>";
    if ($note != '') {
        print "<div class=\"featureNote span9\">";
        print "<small><em>" . $note . "</em></small>";
        print "</div>";
    }
}
Ejemplo n.º 2
0
			<td>
				<?php 
if (isset($ua->isComputer)) {
    print convertTF($ua->isComputer);
} else {
    print "<span class='label important'>false</span>";
}
?>
			</td>
		</tr>
		<tr>
			<th>Is Spider?</th>
			<td>
				<?php 
if (isset($ua->isSpider)) {
    print convertTF($ua->isSpider);
} else {
    print "<span class='label important'>false</span>";
}
?>
			</td>
		</tr>
	</tbody>
</table>

<p>
	<strong>Something wrong with this profile?</strong> Please, <a href="contact.php?cid=<?php 
echo $ua->uaHash;
?>
">let me know</a>. Note that
	the <strong>"tablet" classification may be incorrect</strong> for those Android tablets using an OS older than Android 3.0.
Ejemplo n.º 3
0
/**
 * @param \Detector\Detector $detector
 * @param \stdClass          $ua
 * @param string             $match
 * @param string             $title
 * @param string             $prefix
 * @param string             $note
 */
function createFT(Detector $detector, $ua, $match, $title, $prefix = '', $note = '')
{
    ?>
    <div class="table table-hover table-striped">
    <div class="text-center clearfix thead">
        <div class="col-xs-6 col-sm-4 col-md-4 col-lg-4 col-xl-4 th">
            <?php 
    echo htmlentities($title);
    ?>
        </div>
        <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 th">Your Browser</div>
        <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 th">Detector Profile</div>
    </div>
    <?php 
    $check = 0;
    foreach ($ua as $key => $value) {
        if (!preg_match($match, $key)) {
            continue;
        }
        $check = 1;
        if (is_object($value)) {
            foreach ($value as $vkey => $vvalue) {
                ?>
                <div class="clearfix tbody">
                    <div class="col-xs-6 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-left">
                        <?php 
                echo htmlentities($key . '->' . $vkey);
                ?>
                    </div>
                    <?php 
                if ($detector->whereFound() == 'archive') {
                    ?>
                        <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center"><span
                                class="label label-info">N/A</span></div>
                    <?php 
                } else {
                    ?>
                        <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center">
                            <script type="text/javascript">
                                if (typeof Modernizr === 'undefined') {
                                    document.write("<span class='label label-info'>unknown</span>");
                                } else if (Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
'] === true) {
                                    document.write("<span class='label label-success'>" + Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
'] + "</span>");
                                } else if (Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
'] === false) {
                                    document.write("<span class='label label-danger'>" + Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
'] + "</span>");
                                } else if (Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
']) {
                                    document.write("<span class='label label-warning'>" + Modernizr['<?php 
                    echo $prefix . $key;
                    ?>
']['<?php 
                    echo $vkey;
                    ?>
'] + "</span>");
                                } else {
                                    document.write("<span class='label label-info'>unknown</span>");
                                }
                            </script>
                        </div>
                    <?php 
                }
                ?>

                    <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center"><?php 
                echo convertTF($vvalue);
                ?>
</div>
                </div>
            <?php 
            }
        } else {
            ?>
            <div class="clearfix tbody">
                <div class="col-xs-6 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-left">
                    <?php 
            echo htmlentities($key);
            ?>
                </div>
                <?php 
            if ($detector->whereFound() == 'archive') {
                ?>
                    <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center"><span class="label label-info">N/A</span>
                    </div>
                <?php 
            } else {
                ?>
                    <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center">
                        <script type="text/javascript">
                            if (typeof Modernizr === 'undefined') {
                                document.write("<span class='label label-info'>unknown</span>");
                            } else if (Modernizr['<?php 
                echo $prefix . $key;
                ?>
'] === true) {
                                document.write("<span class='label label-success'>" + Modernizr['<?php 
                echo $prefix . $key;
                ?>
'] + "</span>");
                            } else if (Modernizr['<?php 
                echo $prefix . $key;
                ?>
'] === false) {
                                document.write("<span class='label label-danger'>" + Modernizr['<?php 
                echo $prefix . $key;
                ?>
'] + "</span>");
                            } else if (Modernizr['<?php 
                echo $prefix . $key;
                ?>
']) {
                                document.write("<span class='label label-warning'>" + Modernizr['<?php 
                echo $prefix . $key;
                ?>
'] + "</span>");
                            } else {
                                document.write("<span class='label label-info'>unknown</span>");
                            }
                        </script>
                    </div>
                <?php 
            }
            ?>

                <div class="col-xs-3 col-sm-4 col-md-4 col-lg-4 col-xl-4 text-center"><?php 
            echo convertTF($value);
            ?>
</div>
            </div>
        <?php 
        }
    }
    if ($check == 0) {
        ?>
        <div class="clearfix text-left tbody">
            Detector wasn't able to capture these features because they rely on a cookie that was set after the PHP
            script ran.
        </div>
    <?php 
    }
    ?>
    </div>
    <?php 
    if ($note != '') {
        ?>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 clearfix">
            <small><em><?php 
        echo $note;
        ?>
</em></small>
        </div>
    <?php 
    }
}