Bonjour à tous et merci pour vos éventuelles réponses.
Ci-dessous un code PHP qui reconnaît IE6 (un plug-in de Joomla), je voudrais, mais je n'y connais pas grand chose, reconnaître >=IE7, à partir de ce code. Je pense que la réponse est simple, mais suis vraiment un "nul" !!
Modifié par IED Factory (15 Apr 2010 - 10:07)
Ci-dessous un code PHP qui reconnaît IE6 (un plug-in de Joomla), je voudrais, mais je n'y connais pas grand chose, reconnaître >=IE7, à partir de ce code. Je pense que la réponse est simple, mais suis vraiment un "nul" !!
[code=php]<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgSystemSevenup extends JPlugin
{
function plgSystemSevenup(& $subject, $config)
{
parent::__construct($subject, $config);
//load the translation
//$this->loadLanguage( );
}
function onAfterInitialise()
{
global $mainframe;
$document = &JFactory::getDocument();
if ($this->isIE6() || $this->params->get('showToAllBrowsers',0)==1 ) {
$document->addScript(JURI::base().'plugins/system/sevenup/js/sevenup.0.3.min.js');
if ($this->params->get('useBlackPlugin',1)==1) {
$document->addScript(JURI::base().'plugins/system/sevenup/js/sevenup_black.0.3.min.js');
}
}
}
function onAfterRender()
{
if ($this->isIE6() || $this->params->get('showToAllBrowsers',0)==1 ) {
$buffer = JResponse::getBody();
$buffer = preg_replace('/<\/body>/', ($this->params->get('showToAllBrowsers',0)==1?'':' <!--[if lte IE 6]> ') . '
<script type="text/javascript">
var options = {
enableClosing: ' . ($this->params->get('enableClosing', 0)==1 ? 'true' : 'false') . ',
enableQuitBuggingMe: ' . ($this->params->get('enableQuitBuggingMe', 0)==1?'true':'false') . ',
overlayColor: "' . $this->params->get('overlayColor') . '" ,
lightboxColor: "' . $this->params->get('lightboxColor') . '" ,
borderColor: "' . $this->params->get('borderColor') . '" ,
showToAllBrowsers: ' . ($this->params->get('showToAllBrowsers',0)==1?'true':'false') . '
};
var callback = function() {
// Switch IE-specific content
// AJAX call to map IP to "IE6 user" status
// etc.
}
window.addEvent(\'domready\', function(){ sevenUp.' . ($this->params->get('useBlackPlugin',1)==1?'plugin.black.':'') . 'test(options, null); });
</script>
' . ($this->params->get('showToAllBrowsers',0)==1?'':' <![endif]--> ') . ' </body>', $buffer);
JResponse::setBody($buffer);
}
return true;
}
function isIE6 () { // Deprecated?
$msie='/msie\s(5\.[5-9]|[6]\.[0-9]*).*(win)/i';
return isset($_SERVER['HTTP_USER_AGENT']) &&
preg_match($msie,$_SERVER['HTTP_USER_AGENT']) &&
!preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT']);
}
}
Modifié par IED Factory (15 Apr 2010 - 10:07)