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


PHP Kurogo::deviceClassifier方法代码示例

本文整理汇总了PHP中Kurogo::deviceClassifier方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::deviceClassifier方法的具体用法?PHP Kurogo::deviceClassifier怎么用?PHP Kurogo::deviceClassifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kurogo的用法示例。


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

示例1: _outputTypeFile

function _outputTypeFile($matches)
{
    $file = $matches[3];
    $prefix = '';
    $bits = explode("/", $file);
    if (count($bits) > 1) {
        $file = array_pop($bits);
        $prefix = trim(implode("/", $bits), "/") . '/';
    }
    $platform = Kurogo::deviceClassifier()->getPlatform();
    $pagetype = Kurogo::deviceClassifier()->getPagetype();
    $browser = Kurogo::deviceClassifier()->getBrowser();
    $testDirs = array(THEME_DIR, SHARED_THEME_DIR, SITE_APP_DIR, SHARED_APP_DIR, APP_DIR);
    $testFiles = array("{$prefix}{$pagetype}-{$platform}-{$browser}/{$file}", "{$prefix}{$pagetype}-{$platform}/{$file}", "{$prefix}{$pagetype}/{$file}", "{$prefix}{$file}");
    foreach ($testDirs as $dir) {
        //do not assume dirs have value set
        if ($dir) {
            $dir .= '/' . $matches[1] . $matches[2];
            foreach ($testFiles as $file) {
                Kurogo::log(LOG_DEBUG, "Looking for {$dir}/{$file}", 'index');
                if ($file = realpath_exists("{$dir}/{$file}")) {
                    _outputFile($file);
                }
            }
        }
    }
    _404();
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:28,代码来源:index.php

示例2: _outputTypeFile

function _outputTypeFile($matches) { 
  $file = $matches[3];

  $platform = Kurogo::deviceClassifier()->getPlatform();
  $pagetype = Kurogo::deviceClassifier()->getPagetype();
  
  $testDirs = array(
    THEME_DIR.'/'.$matches[1].$matches[2],
    SITE_DIR.'/'.$matches[1].$matches[2],
    APP_DIR.'/'.$matches[1].$matches[2],
  );
  
  $testFiles = array(
    "$pagetype-$platform/$file",
    "$pagetype/$file",
    "$file",
  );
  
  foreach ($testDirs as $dir) {
    foreach ($testFiles as $file) {
      if ($file = realpath_exists("$dir/$file")) {
          _outputFile($file);
      }
    }
  }

  _404();
}
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:28,代码来源:index.php

示例3: logView

 public static function logView($service, $id, $page, $data, $dataLabel, $size = 0)
 {
     switch ($service) {
         case 'web':
         case 'api':
             break;
         default:
             throw new Exception("Invalid service {$service}");
             break;
     }
     $deviceClassifier = Kurogo::deviceClassifier();
     $ip = Kurogo::determineIP();
     $requestURI = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
     $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $visitID = self::getVisitID($service);
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         $session = Kurogo::getSession();
         $user = $session->getUser();
     } else {
         $user = false;
     }
     $logData = array('timestamp' => time(), 'date' => date('Y-m-d H:i:s'), 'site' => SITE_KEY, 'service' => $service, 'requestURI' => $requestURI, 'referrer' => $referrer, 'referredSite' => intval(self::isFromThisSite($referrer)), 'referredModule' => intval(self::isFromModule($referrer, $id)), 'userAgent' => $userAgent, 'ip' => $ip, 'user' => $user ? $user->getUserID() : '', 'authority' => $user ? $user->getAuthenticationAuthorityIndex() : '', 'visitID' => $visitID, 'pagetype' => $deviceClassifier->getPageType(), 'platform' => $deviceClassifier->getPlatform(), 'moduleID' => $id, 'page' => $page, 'data' => $data, 'dataLabel' => $dataLabel, 'size' => $size, 'elapsed' => Kurogo::getElapsed());
     try {
         $conn = self::connection();
     } catch (KurogoDataServerException $e) {
         throw new KurogoConfigurationException("Database not configured for statistics. To disable stats, set STATS_ENABLED=0 in site.ini");
     }
     $sql = sprintf("INSERT INTO %s (%s) VALUES (%s)", Kurogo::getOptionalSiteVar("KUROGO_STATS_TABLE", "kurogo_stats_v1"), implode(",", array_keys($logData)), implode(",", array_fill(0, count($logData), '?')));
     if (!($result = $conn->query($sql, array_values($logData), db::IGNORE_ERRORS))) {
         self::createStatsTables();
         $result = $conn->query($sql, array_values($logData));
     }
     return $result;
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:35,代码来源:KurogoStats.php

示例4: init

 protected function init($page, $args) {
     if(!Kurogo::getSiteVar('PRODUCTION_ERROR_HANDLER_ENABLED')) {
       set_exception_handler("exceptionHandlerForError");
     }
     $this->pagetype = Kurogo::deviceClassifier()->getPagetype();
     $this->platform = Kurogo::deviceClassifier()->getPlatform();
     $this->page = 'index';
     $this->setTemplatePage($this->page, $this->id);
     $this->args = $args;
     return;
 }
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:11,代码来源:ErrorWebModule.php

示例5: getCreditsHTML

 protected function getCreditsHTML()
 {
     //get original device
     $device = Kurogo::deviceClassifier()->getDevice();
     //set browser to unknown so we don't get AppQ HTML
     Kurogo::deviceClassifier()->setBrowser('unknown');
     $module = WebModule::factory($this->configModule, 'credits_html');
     $html = $module->fetchPage();
     //restore device
     Kurogo::deviceClassifier()->setDevice($device);
     return $html;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:12,代码来源:AboutAPIModule.php

示例6: init

 protected function init($page = '', $args = array())
 {
     if (!Kurogo::getSiteVar('PRODUCTION_ERROR_HANDLER_ENABLED')) {
         set_exception_handler("exceptionHandlerForError");
     }
     $this->pagetype = Kurogo::deviceClassifier()->getPagetype();
     $this->platform = Kurogo::deviceClassifier()->getPlatform();
     $this->page = 'index';
     $this->setTemplatePage($this->page, $this->id);
     $this->args = $args;
     $this->logView = Kurogo::getOptionalSiteVar('STATS_ENABLED', true) ? true : false;
     try {
         $this->moduleName = $this->getOptionalModuleVar('title', 'Error', 'module');
     } catch (KurogoConfigurationException $e) {
     }
     return;
 }
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:17,代码来源:ErrorWebModule.php

示例7: _outputTypeFile

function _outputTypeFile($matches)
{
    $file = $matches[3];
    $platform = Kurogo::deviceClassifier()->getPlatform();
    $pagetype = Kurogo::deviceClassifier()->getPagetype();
    $browser = Kurogo::deviceClassifier()->getBrowser();
    $testDirs = array(THEME_DIR . '/' . $matches[1] . $matches[2], SITE_APP_DIR . '/' . $matches[1] . $matches[2], SHARED_APP_DIR . '/' . $matches[1] . $matches[2], APP_DIR . '/' . $matches[1] . $matches[2]);
    $testFiles = array("{$pagetype}-{$platform}-{$browser}/{$file}", "{$pagetype}-{$platform}/{$file}", "{$pagetype}/{$file}", "{$file}");
    foreach ($testDirs as $dir) {
        foreach ($testFiles as $file) {
            if ($file = realpath_exists("{$dir}/{$file}")) {
                _outputFile($file);
            }
        }
    }
    _404();
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:17,代码来源:index.php

示例8: init

 protected function init($page = '', $args = array())
 {
     if ($page == 'error') {
         if (!Kurogo::getSiteVar('PRODUCTION_ERROR_HANDLER_ENABLED')) {
             set_exception_handler("exceptionHandlerForError");
         }
         $this->pagetype = Kurogo::deviceClassifier()->getPagetype();
         $this->platform = Kurogo::deviceClassifier()->getPlatform();
         $this->browser = Kurogo::deviceClassifier()->getBrowser();
         $this->page = 'error';
         $this->setTemplatePage($this->page, $this->id);
         $this->setArgs($args);
         $this->ajaxContentLoad = $this->getArg(self::AJAX_PARAMETER) ? true : false;
         $this->logView = Kurogo::getOptionalSiteVar('STATS_ENABLED', true) ? true : false;
         try {
             $this->moduleName = $this->getOptionalModuleVar('title', 'Error', 'module');
         } catch (KurogoConfigurationException $e) {
         }
     } else {
         $this->redirectToModule($this->getHomeModuleID(), 'index');
     }
     return;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:23,代码来源:KurogoWebModule.php

示例9: initializeForCommand

 public function initializeForCommand()
 {
     switch ($this->command) {
         case 'hello':
             $allmodules = $this->getAllModules();
             $homeModuleData = $this->getModuleNavigationData();
             $homeModules = array('primary' => isset($homeModuleData['primary']) ? array_keys($homeModuleData['primary']) : array(), 'secondary' => isset($homeModuleData['secondary']) ? array_keys($homeModuleData['secondary']) : array());
             foreach ($allmodules as $moduleID => $module) {
                 if ($module->isEnabled()) {
                     $home = false;
                     if (($key = array_search($moduleID, $homeModules['primary'])) !== FALSE) {
                         $home = array('type' => 'primary', 'order' => $key, 'title' => $homeModuleData['primary'][$moduleID]);
                     } elseif (($key = array_search($moduleID, $homeModules['secondary'])) !== FALSE) {
                         $home = array('type' => 'secondary', 'order' => $key);
                     }
                     $modules[] = array('id' => $module->getID(), 'tag' => $module->getConfigModule(), 'title' => $module->getModuleVar('title', 'module'), 'access' => $module->getAccess(AccessControlList::RULE_TYPE_ACCESS), 'payload' => $module->getPayload(), 'vmin' => $module->getVmin(), 'vmax' => $module->getVmax(), 'home' => $home);
                 }
             }
             $response = array('timezone' => Kurogo::getSiteVar('LOCAL_TIMEZONE'), 'version' => KUROGO_VERSION, 'modules' => $modules, 'default' => Kurogo::defaultModule());
             $this->setResponse($response);
             $this->setResponseVersion(2);
             break;
         case 'classify':
             $userAgent = $this->getArg('useragent');
             if (!$userAgent) {
                 throw new KurogoException("useragent parameter not specified");
             }
             $response = Kurogo::deviceClassifier()->classifyUserAgent($userAgent);
             $this->setResponse($response);
             $this->setResponseVersion(1);
             break;
         default:
             $this->invalidCommand();
             break;
     }
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:36,代码来源:CoreAPIModule.php

示例10: loadDeviceClassifierIfNeeded

 protected function loadDeviceClassifierIfNeeded()
 {
     $this->deviceClassifier = Kurogo::deviceClassifier();
 }
开发者ID:rolandinsh,项目名称:Kurogo-Mobile-Web,代码行数:4,代码来源:WebModule.php

示例11: initializeForPage

 protected function initializeForPage()
 {
     //make sure that only desktop/tablet devices can use the module
     $deviceClassifier = Kurogo::deviceClassifier();
     if ($this->page != 'index' && !($deviceClassifier->isComputer() || $deviceClassifier->isTablet())) {
         $this->redirectTo('index');
     }
     $navSections = $this->getNavSections();
     $section = '';
     $this->assign('navSections', $navSections);
     $this->addJQuery();
     $this->addJQueryUI();
     switch ($this->page) {
         case 'modules':
             $subNavSections = $this->getSubNavSections($this->page);
             $this->assign('subNavSections', $subNavSections);
             $defaultSubNavSection = key($subNavSections);
             $section = $this->getArg('section', $defaultSubNavSection);
             $moduleID = $this->getArg('module');
             if ($moduleID) {
                 $this->setTemplatePage('module');
                 try {
                     if ($module = WebModule::factory($moduleID)) {
                         $this->assign('moduleName', $module->getModuleName());
                         $this->assign('moduleID', $module->getConfigModule());
                         $this->assign('moduleIcon', $module->getOptionalModuleVar('icon', $module->getConfigModule(), 'module'));
                         $section = $moduleID;
                         $moduleSection = $this->getArg('section', 'general');
                         $this->assign('moduleSection', $moduleSection);
                     }
                 } catch (KurogoException $e) {
                     $this->redirectTo($this->page, array());
                 }
             } elseif ($section == $defaultSubNavSection) {
                 $moduleClasses = WebModule::getAllModuleClasses();
                 $this->assign('moduleClasses', $moduleClasses);
                 $this->setTemplatePage($section);
             } elseif ($section == 'homescreen') {
                 $this->setTemplatePage($section);
                 $modules = $this->getModules();
                 $this->assign('modules', $modules);
             } else {
                 $this->redirectTo($this->page, array());
             }
             break;
         case 'site':
             $subNavSections = $this->getSubNavSections($this->page);
             $this->assign('subNavSections', $subNavSections);
             $defaultSubNavSection = key($subNavSections);
             $section = $this->getArg('section', $defaultSubNavSection);
             if (!isset($subNavSections[$section])) {
                 $this->redirectTo($this->page, array());
             }
             break;
         case 'credits':
             $section = $this->getArg('section', 'credits');
             $subNavSections = array('credits' => array('id' => 'credits', 'title' => $this->getLocalizedString("ADMIN_CREDITS_CREDITS_TITLE"), 'url' => $this->buildURL($this->page, array('section' => 'credits'))), 'license' => array('id' => 'license', 'title' => $this->getLocalizedString("ADMIN_CREDITS_LICENSE_TITLE"), 'url' => $this->buildURL($this->page, array('section' => 'license'))));
             $this->assign('subNavSections', $subNavSections);
             if (isset($subNavSections[$section])) {
                 switch ($section) {
                     case 'license':
                         $licenseFile = ROOT_DIR . "/LICENSE";
                         if (is_file($licenseFile)) {
                             $this->assign('license', file_get_contents($licenseFile));
                         } else {
                             die($licenseFile);
                             throw new KurogoException("Unable to load LICENSE file, you may have a compromised Kurogo Installation");
                         }
                 }
                 $this->setTemplatePage($section);
             } else {
                 $this->redirectTo('section', array());
             }
             break;
         case 'index':
             //redirect desktop devices to the "default page"
             $deviceClassifier = Kurogo::deviceClassifier();
             if ($deviceClassifier->isComputer() || $deviceClassifier->isTablet()) {
                 $defaultSection = current($navSections);
                 $this->redirectTo($defaultSection['id'], array());
             }
             break;
         default:
             $this->redirectTo('index', array());
             break;
     }
     $this->assign('section', $section);
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:88,代码来源:AdminWebModule.php

示例12: minifyPostProcess

function minifyPostProcess($content, $type) {
  if ($type === Minify::TYPE_CSS) {
    $urlPrefix = URL_PREFIX;
          
    if (Kurogo::getSiteVar('DEVICE_DEBUG') && URL_PREFIX == URL_BASE) {
      // if device debugging is on, always append device classification
      $urlPrefix .= 'device/'.Kurogo::deviceClassifier()->getDevice().'/';
    }

    $content = "/* Adding url prefix '".$urlPrefix."' */\n\n".
      preg_replace(';url\("?\'?/([^"\'\)]+)"?\'?\);', 'url("'.$urlPrefix.'\1")', $content);
  }
  
  return $content;
}
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:15,代码来源:minify.php

示例13: getDevice

 public static function getDevice()
 {
     return Kurogo::deviceClassifier()->getDevice();
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:4,代码来源:Kurogo.php

示例14: exit

<?php

/* Smarty version Smarty-3.0.7, created on 2014-11-26 14:05:47
   compiled from "findInclude:common/templates/videoPlayer.tpl" */
/*%%SmartyHeaderCode:20176320395476248b0f8470-12784728%%*/
if (!defined('SMARTY_DIR')) {
    exit('no direct access allowed');
}
$_smarty_tpl->decodeProperties(array('file_dependency' => array('bb5a0de692e4ffeae0751b86948d1074393f1593' => array(0 => 'findInclude:common/templates/videoPlayer.tpl', 1 => 1364681342, 2 => 'findInclude')), 'nocache_hash' => '20176320395476248b0f8470-12784728', 'function' => array(), 'has_nocache_code' => false));
/*/%%SmartyHeaderCode%%*/
if ($_smarty_tpl->getVariable('video')->value) {
    ?>
  <?php 
    if ($_smarty_tpl->getVariable('video')->value->canPlay(Kurogo::deviceClassifier())) {
        ?>
    <?php 
        $_smarty_tpl->tpl_vars['videoPlayerType'] = new Smarty_variable($_smarty_tpl->getVariable('video')->value->getType(), null, null);
        ?>
    <div class="kgo-videoplayer kgo-videoplayer-<?php 
        echo $_smarty_tpl->getVariable('videoPlayerType')->value;
        ?>
">
      <div class="kgo-videoplayer-container">
        <?php 
        $_template = new Smarty_Internal_Template("findInclude:common/templates/videoPlayer/videoPlayer_" . $_smarty_tpl->getVariable('videoPlayerType')->value . ".tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
        echo $_template->getRenderedTemplate();
        unset($_template);
        ?>
      </div>
    </div>
  <?php 
开发者ID:sponto,项目名称:msbm-mobile,代码行数:31,代码来源:tablet_computer_unknown^bb5a0de692e4ffeae0751b86948d1074393f1593.findInclude.videoPlayer.tpl.php

示例15: initializeForPage


//.........这里部分代码省略.........
                     $items = $controller->items();
                 }
             }
             $totalItems = $controller->getTotalItems();
             $videos = array();
             foreach ($items as $video) {
                 $videos[] = $this->linkForItem($video, array('section' => $section));
             }
             $this->assign('videos', $videos);
             $this->assign('totalItems', $totalItems);
             $previousURL = null;
             $nextURL = null;
             if ($totalItems > $maxPerPage) {
                 $args = $this->args;
                 if ($start > 0) {
                     $args['start'] = $start - $maxPerPage;
                     $previousURL = $this->buildBreadcrumbURL($this->page, $args, false);
                 }
                 if ($totalItems - $start > $maxPerPage) {
                     $args['start'] = $start + $maxPerPage;
                     $nextURL = $this->buildBreadcrumbURL($this->page, $args, false);
                 }
             }
             /* only assign section if it's the search page, otherwise section comes from select box */
             if ($this->page == 'search') {
                 $hiddenArgs = array('section' => $section);
             } else {
                 $hiddenArgs = array();
             }
             $this->addInternalJavascript('/common/javascript/lib/ellipsizer.js');
             $this->addOnLoad('setupVideosListing();');
             $this->assign('placeholder', $this->getLocalizedString('SEARCH_MODULE', $this->getModuleName()));
             $this->assign('start', $start);
             $this->assign('previousURL', $previousURL);
             $this->assign('nextURL', $nextURL);
             $this->assign('hiddenArgs', $hiddenArgs);
             $this->assign('maxPerPage', $maxPerPage);
             if ($this->getOptionalModuleVar('BOOKMARKS_ENABLED', 1)) {
                 $this->generateBookmarkLink();
             }
             break;
         case 'bookmarks':
             if (!$this->getOptionalModuleVar('BOOKMARKS_ENABLED', 1)) {
                 $this->redirectTo('index');
             }
             $controllerCache = array($section => $controller);
             $videos = array();
             foreach ($this->getBookmarks() as $aBookmark) {
                 if (!$aBookmark) {
                     continue;
                 }
                 parse_str(stripslashes($aBookmark), $params);
                 if (isset($params['section'], $this->feeds[$params['section']], $params['videoid'])) {
                     if (!isset($controllerCache[$params['section']])) {
                         $controllerCache[$params['section']] = $this->getFeed($params['section']);
                     }
                     if ($video = $controllerCache[$params['section']]->getItem($params['videoid'])) {
                         $videos[] = $this->linkForItem($video, $params);
                     }
                 }
             }
             $this->assign('videos', $videos);
             $this->addInternalJavascript('/common/javascript/lib/ellipsizer.js');
             $this->addOnLoad('setupVideosListing();');
             break;
         case 'detail':
             $videoid = $this->getArg('videoid');
             if ($video = $controller->getItem($videoid)) {
                 $this->setLogData($videoid, $video->getTitle());
                 $this->setTemplatePage('detail-' . $video->getType());
                 if ($video->canPlay(Kurogo::deviceClassifier())) {
                     $this->assign('videoTitle', $video->getTitle());
                     $this->assign('videoid', $video->getID());
                     $this->assign('videoStreamingURL', $video->getStreamingURL());
                     $this->assign('videoStillImage', $video->getStillFrameImage());
                     $this->assign('videoDescription', $video->getDescription());
                     $this->assign('videoAuthor', $video->getAuthor());
                     $this->assign('videoDate', $video->getPublished()->format('M j, Y'));
                     $body = $video->getDescription() . "\n\n" . $video->getURL();
                     if ($this->getOptionalModuleVar('SHARING_ENABLED', 1)) {
                         $this->assign('shareEmailURL', $this->buildMailToLink("", $video->getTitle(), $body));
                         $this->assign('shareTitle', 'Share this video');
                         $this->assign('videoURL', $video->getURL());
                         $this->assign('shareRemark', $video->getTitle());
                     }
                     // Bookmark
                     if ($this->getOptionalModuleVar('BOOKMARKS_ENABLED', 1)) {
                         $cookieParams = array('section' => $section, 'videoid' => $videoid);
                         $cookieID = http_build_query($cookieParams);
                         $this->generateBookmarkOptions($cookieID);
                     }
                 } else {
                     $this->setTemplatePage('videoError.tpl');
                 }
             } else {
                 $this->redirectTo('index', array('section' => $section), false);
             }
             break;
     }
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:101,代码来源:VideoWebModule.php


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