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


PHP Horde::webServerID方法代码示例

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


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

示例1: downloadUrl

 /**
  * Returns a URL to be used for downloading, that takes into account any
  * special browser quirks (i.e. IE's broken filename handling).
  *
  * @param string $filename  The filename of the download data.
  * @param array $params     Any additional parameters needed.
  * @param string $url       The URL to alter. If none passed in, will use
  *                          the file 'view.php' located in the current
  *                          module's base directory.
  *
  * @return string  The download URL.
  */
 function downloadUrl($filename, $params = array(), $url = null)
 {
     global $browser;
     $horde_url = false;
     if (is_null($url)) {
         global $registry;
         $url = Util::addParameter(Horde::url($registry->get('webroot', 'horde') . '/services/download/'), 'module', $registry->getApp());
         $horde_url = true;
     }
     /* Add parameters. */
     if (!is_null($params)) {
         $url = Util::addParameter($url, $params);
     }
     /* If we are using the default Horde download link, add the
      * filename to the end of the URL. Although not necessary for
      * many browsers, this should allow every browser to download
      * correctly. */
     if ($horde_url) {
         $url = Util::addParameter($url, 'fn', '/' . rawurlencode($filename));
     } elseif ($browser->hasQuirk('break_disposition_filename')) {
         /* Some browsers will only obtain the filename correctly
          * if the extension is the last argument in the query
          * string and rest of the filename appears in the
          * PATH_INFO element. */
         $filename = rawurlencode($filename);
         /* Get the webserver ID. */
         $server = Horde::webServerID();
         /* Get the name and extension of the file.  Apache 2 does
          * NOT support PATH_INFO information being passed to the
          * PHP module by default, so disable that
          * functionality. */
         if ($server != 'apache2') {
             if ($pos = strrpos($filename, '.')) {
                 $name = '/' . preg_replace('/\\./', '%2E', substr($filename, 0, $pos));
                 $ext = substr($filename, $pos);
             } else {
                 $name = '/' . $filename;
                 $ext = '';
             }
             /* Enter the PATH_INFO information. */
             if ($pos = strpos($url, '?')) {
                 $url = substr($url, 0, $pos) . $name . substr($url, $pos);
             } else {
                 $url .= $name;
             }
         }
         /* Append the extension, if it exists. */
         if ($server == 'apache2' || !empty($ext)) {
             $url = Util::addParameter($url, 'fn_ext', '/' . $filename);
         }
     }
     return $url;
 }
开发者ID:justinlyon,项目名称:scc,代码行数:65,代码来源:Horde.php


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