Uri.php #1

  • //
  • guest/
  • perforce_software/
  • chronicle/
  • main/
  • library/
  • P4Cms/
  • Uri.php
  • View
  • Commits
  • Open Download .zip Download (1 KB)
<?php
/**
 * Extends Zend_Uri to provide additional utility methods.
 *
 * @copyright   2011 Perforce Software. All rights reserved.
 * @license     Please see LICENSE.txt in top-level folder of this distribution.
 * @version     <release>/<patch>
 */
abstract class P4Cms_Uri extends Zend_Uri
{
    /**
     * Determine if the given uri is relative.
     *
     * @param   string  $uri    the uri to examine.
     * @return  boolean         true if the uri is relative.
     */
    public static function isRelativeUri($uri)
    {
        if (substr($uri, 0, 1) == "/") {
            return false;
        }
        if (static::hasScheme($uri)) {
            return false;
        }
        return true;
    }

    /**
     * Determines if the given uri has a scheme component
     * (e.g. http://).
     *
     * @param   string  $uri    the uri to examine.
     * @return  bool    true if the uri has a scheme.
     */
    public static function hasScheme($uri)
    {
        return (bool) preg_match("/^[a-zA-Z]+:\//", $uri);
    }
}
# Change User Description Committed
#1 16170 perforce_software Move Chronicle files to follow new path scheme for branching.
//guest/perforce_software/chronicle/library/P4Cms/Uri.php
#1 8972 Matt Attaway Initial add of the Chronicle source code