当前位置: 首页>>代码示例>>PHP>>正文


PHP get_browser_version_classes函数代码示例

本文整理汇总了PHP中get_browser_version_classes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_browser_version_classes函数的具体用法?PHP get_browser_version_classes怎么用?PHP get_browser_version_classes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_browser_version_classes函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialise_standard_body_classes

    protected function initialise_standard_body_classes() {
        global $CFG, $USER;

        $pagetype = $this->pagetype;
        if ($pagetype == 'site-index') {
            $this->_legacyclass = 'course';
        } else if (substr($pagetype, 0, 6) == 'admin-') {
            $this->_legacyclass = 'admin';
        }
        $this->add_body_class($this->_legacyclass);

        $pathbits = explode('-', trim($pagetype));
        for ($i=1;$i<count($pathbits);$i++) {
            $this->add_body_class('path-'.join('-',array_slice($pathbits, 0, $i)));
        }

        $this->add_body_classes(get_browser_version_classes());
        $this->add_body_class('dir-' . get_string('thisdirection', 'langconfig'));
        $this->add_body_class('lang-' . current_language());
        $this->add_body_class('yui-skin-sam'); // Make YUI happy, if it is used.
        $this->add_body_class('yui3-skin-sam'); // Make YUI3 happy, if it is used.
        $this->add_body_class($this->url_to_class_name($CFG->wwwroot));

        $this->add_body_class('pagelayout-' . $this->_pagelayout); // extra class describing current page layout

        if (!during_initial_install()) {
            $this->add_body_class('course-' . $this->_course->id);
            $this->add_body_class('context-' . $this->_context->id);
        }

        if (!empty($this->_cm)) {
            $this->add_body_class('cmid-' . $this->_cm->id);
        }

        if (!empty($CFG->allowcategorythemes)) {
            $this->ensure_category_loaded();
            foreach ($this->_categories as $catid => $notused) {
                $this->add_body_class('category-' . $catid);
            }
        } else {
            $catid = 0;
            if (is_array($this->_categories)) {
                $catids = array_keys($this->_categories);
                $catid = reset($catids);
            } else if (!empty($this->_course->category)) {
                $catid = $this->_course->category;
            }
            if ($catid) {
                $this->add_body_class('category-' . $catid);
            }
        }

        if (!isloggedin()) {
            $this->add_body_class('notloggedin');
        }

        if (!empty($USER->editing)) {
            $this->add_body_class('editing');
            if (optional_param('bui_moveid', false, PARAM_INT)) {
               $this->add_body_class('blocks-moving');
        }
        }

        if (!empty($CFG->blocksdrag)) {
            $this->add_body_class('drag');
        }

        if ($this->_devicetypeinuse != 'default') {
            $this->add_body_class($this->_devicetypeinuse . 'theme');
        }
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:71,代码来源:pagelib.php

示例2: test_get_browser_version_classes

 function test_get_browser_version_classes()
 {
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Safari']['2.0']['Mac OS X'];
     $this->assertEqual(array('safari'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Opera']['9.0']['Windows XP'];
     $this->assertEqual(array('opera'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['6.0']['Windows XP SP2'];
     $this->assertEqual(array('ie', 'ie6'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['7.0']['Windows XP SP2'];
     $this->assertEqual(array('ie', 'ie7'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['8.0']['Windows Vista'];
     $this->assertEqual(array('ie', 'ie8'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Firefox']['2.0']['Windows XP'];
     $this->assertEqual(array('gecko', 'gecko18'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Firefox']['3.0.6']['SUSE'];
     $this->assertEqual(array('gecko', 'gecko19'), get_browser_version_classes());
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:17,代码来源:testmoodlelib.php

示例3: test_get_browser_version_classes

 function test_get_browser_version_classes()
 {
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Safari']['412']['Mac OS X'];
     $this->assertEqual(array('safari'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Chrome']['8']['Mac OS X'];
     $this->assertEqual(array('safari'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Safari iOS']['528']['iPhone'];
     $this->assertEqual(array('safari', 'ios'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['WebKit Android']['530']['Nexus'];
     $this->assertEqual(array('safari', 'android'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Chrome']['8']['Mac OS X'];
     $this->assertEqual(array('safari'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Opera']['9.0']['Windows XP'];
     $this->assertEqual(array('opera'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['6.0']['Windows XP SP2'];
     $this->assertEqual(array('ie', 'ie6'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['7.0']['Windows XP SP2'];
     $this->assertEqual(array('ie', 'ie7'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['MSIE']['8.0']['Windows Vista'];
     $this->assertEqual(array('ie', 'ie8'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Firefox']['2.0']['Windows XP'];
     $this->assertEqual(array('gecko', 'gecko18'), get_browser_version_classes());
     $_SERVER['HTTP_USER_AGENT'] = $this->user_agents['Firefox']['3.0.6']['SUSE'];
     $this->assertEqual(array('gecko', 'gecko19'), get_browser_version_classes());
 }
开发者ID:richheath,项目名称:moodle,代码行数:25,代码来源:testmoodlelib.php

示例4: initialise_standard_body_classes

 protected function initialise_standard_body_classes()
 {
     global $CFG, $USER;
     $pagetype = $this->pagetype;
     if ($pagetype == 'site-index') {
         $this->_legacyclass = 'course';
     } else {
         if (substr($pagetype, 0, 6) == 'admin-') {
             $this->_legacyclass = 'admin';
         } else {
             $this->_legacyclass = substr($pagetype, 0, strrpos($pagetype, '-'));
         }
     }
     $this->add_body_class($this->_legacyclass);
     $this->add_body_classes(get_browser_version_classes());
     $this->add_body_class('dir-' . get_string('thisdirection'));
     $this->add_body_class('lang-' . current_language());
     $this->add_body_class('yui-skin-sam');
     // Make YUI happy, if it is used.
     $this->add_body_class($this->url_to_class_name($CFG->wwwroot));
     if (!during_initial_install()) {
         $this->add_body_class('course-' . $this->_course->id);
         $this->add_body_class('context-' . $this->context->id);
     }
     if (!empty($this->_cm)) {
         $this->add_body_class('cmid-' . $this->_cm->id);
     }
     if (!empty($CFG->allowcategorythemes)) {
         $this->ensure_category_loaded();
         foreach ($this->_categories as $catid => $notused) {
             $this->add_body_class('category-' . $catid);
         }
     } else {
         $catid = 0;
         if (is_array($this->_categories)) {
             $catids = array_keys($this->_categories);
             $catid = reset($catids);
         } else {
             if (!empty($this->_course->category)) {
                 $catid = $this->_course->category;
             }
         }
         if ($catid) {
             $this->add_body_class('category-' . $catid);
         }
     }
     if (!isloggedin()) {
         $this->add_body_class('notloggedin');
     }
     if (!empty($USER->editing)) {
         $this->add_body_class('editing');
     }
     if (!empty($CFG->blocksdrag)) {
         $this->add_body_class('drag');
     }
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:56,代码来源:pagelib.php


注:本文中的get_browser_version_classes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。