Exemple #1
0
 /**
  * Gets the value of the PathInfo item at index $intIndex.  Will return NULL if it doesn't exist.
  * If no $intIndex is given will return an array with PathInfo contents.
  *
  * The way PathInfo index is determined is, for example, given a URL '/folder/page.php/id/15/blue',
  * QApplication::PathInfo(0) will return 'id'
  * QApplication::PathInfo(1) will return '15'
  * QApplication::PathInfo(2) will return 'blue'
  *
  * @return mixed
  */
 public static function PathInfo($intIndex = null)
 {
     // Lookup PathInfoArray from cache, or create it into cache if it doesn't yet exist
     if (!isset(self::$arrPathInfo)) {
         $strPathInfo = QApplication::$PathInfo;
         self::$arrPathInfo = array();
         if ($strPathInfo != '') {
             if ($strPathInfo == '/') {
                 self::$arrPathInfo[0] = '';
             } else {
                 // Remove Trailing '/'
                 if (QString::FirstCharacter($strPathInfo) == '/') {
                     $strPathInfo = substr($strPathInfo, 1);
                 }
                 self::$arrPathInfo = explode('/', $strPathInfo);
             }
         }
     }
     if ($intIndex === null) {
         return self::$arrPathInfo;
     } elseif (array_key_exists($intIndex, self::$arrPathInfo)) {
         return self::$arrPathInfo[$intIndex];
     } else {
         return null;
     }
 }