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


PHP Horde_String::common方法代码示例

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


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

示例1: getPathInfo

 /**
  * Utility function to obtain PATH_INFO information.
  *
  * @return string  The PATH_INFO string.
  */
 public static function getPathInfo()
 {
     if (isset($_SERVER['PATH_INFO']) && strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') === false) {
         return $_SERVER['PATH_INFO'];
     } elseif (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SCRIPT_NAME'])) {
         $search = Horde_String::common($_SERVER['SCRIPT_NAME'], $_SERVER['REQUEST_URI']);
         if (substr($search, -1) == '/') {
             $search = substr($search, 0, -1);
         }
         $search = array($search);
         if (!empty($_SERVER['QUERY_STRING'])) {
             // We can't use QUERY_STRING directly because URL rewriting
             // might add more parameters to the query string than those
             // from the request URI.
             $url = parse_url($_SERVER['REQUEST_URI']);
             if (!empty($url['query'])) {
                 $search[] = '?' . $url['query'];
             }
         }
         $path = str_replace($search, '', $_SERVER['REQUEST_URI']);
         if ($path == '/') {
             $path = '';
         }
         return $path;
     }
     return '';
 }
开发者ID:Jony01,项目名称:LLD,代码行数:32,代码来源:Util.php

示例2: __construct

 /**
  * Constructs a standard page class to represent a wiki page.
  *
  * @param string $pagename The name of the page to represent.
  */
 public function __construct($pagename)
 {
     if (is_array($pagename)) {
         $this->_page = $pagename;
         return;
     }
     $page = null;
     try {
         $page = $GLOBALS['wicked']->retrieveByName($pagename);
     } catch (Wicked_Exception $e) {
         // If we can't load $pagename, see if there's default data for it.
         // Protect against directory traversion.
         $pagepath = realpath(WICKED_BASE . '/data/' . $GLOBALS['conf']['wicked']['format']);
         $pagefile = realpath($pagepath . '/' . $pagename);
         if ($pagefile && Horde_String::common($pagefile, $pagepath) == $pagepath && substr($pagename, 0, 1) != '.' && file_exists($pagefile) && ($text = file_get_contents($pagefile))) {
             try {
                 $GLOBALS['wicked']->newPage($pagename, $text);
                 try {
                     $page = $GLOBALS['wicked']->retrieveByName($pagename);
                 } catch (Wicked_Exception $e) {
                     $GLOBALS['notification']->push(sprintf(_("Unable to create %s"), $pagename), 'horde.error');
                 }
             } catch (Wicked_Exception $e) {
             }
         }
     }
     if ($page) {
         $this->_page = $page;
     } else {
         if ($pagename == 'Wiki/Home') {
             $GLOBALS['notification']->push(_("Unable to create Wiki/Home. The wiki is not configured."), 'horde.error');
         }
         $this->_page = array();
     }
     // Make sure 'wicked' permission exists. Set reasonable defaults if
     // necessary.
     $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
     $corePerms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
     if (!$perms->exists('wicked')) {
         $perm = $corePerms->newPermission('wicked');
         $perm->addGuestPermission(Horde_Perms::SHOW | Horde_Perms::READ, false);
         $perm->addDefaultPermission(Horde_Perms::SHOW | Horde_Perms::READ | Horde_Perms::EDIT | Horde_Perms::DELETE, false);
         $perms->addPermission($perm);
     }
     // Make sure 'wicked:pages' exists. Copy from 'wicked' if it does not
     // exist.
     if (!$perms->exists('wicked:pages')) {
         $perm = $corePerms->newPermission('wicked:pages');
         $copyFrom = $perms->getPermission('wicked');
         $perm->addGuestPermission($copyFrom->getGuestPermissions(), false);
         $perm->addDefaultPermission($copyFrom->getDefaultPermissions(), false);
         $perm->addCreatorPermission($copyFrom->getCreatorPermissions(), false);
         foreach ($copyFrom->getUserPermissions() as $user => $uperm) {
             $perm->addUserPermission($user, $uperm, false);
         }
         foreach ($copyFrom->getGroupPermissions() as $group => $gperm) {
             $perm->addGroupPermission($group, $gperm, false);
         }
         $perms->addPermission($perm);
     }
     if ($GLOBALS['conf']['lock']['driver'] != 'none') {
         $this->supportedModes[Wicked::MODE_LOCKING] = $this->supportedModes[Wicked::MODE_UNLOCKING] = true;
         $this->_locks = $GLOBALS['injector']->getInstance('Horde_Lock');
         $locks = $this->_locks->getLocks('wicked', $pagename, Horde_Lock::TYPE_EXCLUSIVE);
         if ($locks) {
             $this->_lock = reset($locks);
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:74,代码来源:StandardPage.php

示例3: selfUrl

 /**
  * Returns a session-id-ified version of $SCRIPT_NAME resp. $PHP_SELF.
  *
  * @param boolean $script_params Include script parameters like
  *                               QUERY_STRING and PATH_INFO?
  *                               (Deprecated: use Horde::selfUrlParams()
  *                               instead.)
  * @param boolean $nocache       Include a cache-buster parameter in the
  *                               URL?
  * @param boolean $full          Return a full URL?
  * @param boolean $force_ssl     Ignore $conf['use_ssl'] and force creation
  *                               of a SSL URL?
  *
  * @return Horde_Url  The requested URL.
  */
 public static function selfUrl($script_params = false, $nocache = true, $full = false, $force_ssl = false)
 {
     if (!strncmp(PHP_SAPI, 'cgi', 3)) {
         // When using CGI PHP, SCRIPT_NAME may contain the path to
         // the PHP binary instead of the script being run; use
         // PHP_SELF instead.
         $url = $_SERVER['PHP_SELF'];
     } else {
         $url = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF'];
     }
     if (isset($_SERVER['REQUEST_URI'])) {
         $url = Horde_String::common($_SERVER['REQUEST_URI'], $url);
     }
     if (substr($url, -9) == 'index.php') {
         $url = substr($url, 0, -9);
     }
     if ($script_params) {
         if ($pathInfo = Horde_Util::getPathInfo()) {
             if (substr($url, -1) == '/') {
                 $pathInfo = substr($pathInfo, 1);
             }
             $url .= $pathInfo;
         }
         if (!empty($_SERVER['QUERY_STRING'])) {
             $url .= '?' . $_SERVER['QUERY_STRING'];
         }
     }
     $url = self::url($url, $full, array('force_ssl' => $force_ssl));
     return $nocache && $GLOBALS['browser']->hasQuirk('cache_same_url') ? $url->unique() : $url;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:45,代码来源:Horde.php


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