original_string: public static function getCurrentScriptName($removePathInfo = true)
      {
          $url = '';
  
          // insert extra path info if proxy_uri_header is set and enabled
          if (isset(Config::getInstance()->General['proxy_uri_header'])
              && Config::getInstance()->General['proxy_uri_header'] == 1
              && !empty($_SERVER['HTTP_X_FORWARDED_URI'])
          ) {
              $url .= $_SERVER['HTTP_X_FORWARDED_URI'];
          }
  
          if (!empty($_SERVER['REQUEST_URI'])) {
              $url .= $_SERVER['REQUEST_URI'];
  
              // strip http://host (Apache+Rails anomaly)
              if (preg_match('~^https?://[^/]+($|/.*)~D', $url, $matches)) {
                  $url = $matches[1];
              }
  
              // strip parameters
              if (($pos = strpos($url, "?")) !== false) {
                  $url = substr($url, 0, $pos);
              }
  
              // strip path_info
              if ($removePathInfo && !empty($_SERVER['PATH_INFO'])) {
                  $url = substr($url, 0, -strlen($_SERVER['PATH_INFO']));
              }
          }
  
          /**
           * SCRIPT_NAME is our fallback, though it may not be set correctly
           *
           * @see http://php.net/manual/en/reserved.variables.php
           */
          if (empty($url)) {
              if (isset($_SERVER['SCRIPT_NAME'])) {
                  $url = $_SERVER['SCRIPT_NAME'];
              } elseif (isset($_SERVER['SCRIPT_FILENAME'])) {
                  $url = $_SERVER['SCRIPT_FILENAME'];
              } elseif (isset($_SERVER['argv'])) {
                  $url = $_SERVER['argv'][0];
              }
          }
  
          if (!isset($url[0]) || $url[0] !== '/') {
              $url = '/' . $url;
          }
          return $url;
      }
code: public static function getCurrentScriptName($removePathInfo = true)
      {
          $url = '';
  
          // insert extra path info if proxy_uri_header is set and enabled
          if (isset(Config::getInstance()->General['proxy_uri_header'])
              && Config::getInstance()->General['proxy_uri_header'] == 1
              && !empty($_SERVER['HTTP_X_FORWARDED_URI'])
          ) {
              $url .= $_SERVER['HTTP_X_FORWARDED_URI'];
          }
  
          if (!empty($_SERVER['REQUEST_URI'])) {
              $url .= $_SERVER['REQUEST_URI'];
  
              // strip http://host (Apache+Rails anomaly)
              if (preg_match('~^https?://[^/]+($|/.*)~D', $url, $matches)) {
                  $url = $matches[1];
              }
  
              // strip parameters
              if (($pos = strpos($url, "?")) !== false) {
                  $url = substr($url, 0, $pos);
              }
  
              // strip path_info
              if ($removePathInfo && !empty($_SERVER['PATH_INFO'])) {
                  $url = substr($url, 0, -strlen($_SERVER['PATH_INFO']));
              }
          }
  
          /**
           * SCRIPT_NAME is our fallback, though it may not be set correctly
           *
           * @see http://php.net/manual/en/reserved.variables.php
           */
          if (empty($url)) {
              if (isset($_SERVER['SCRIPT_NAME'])) {
                  $url = $_SERVER['SCRIPT_NAME'];
              } elseif (isset($_SERVER['SCRIPT_FILENAME'])) {
                  $url = $_SERVER['SCRIPT_FILENAME'];
              } elseif (isset($_SERVER['argv'])) {
                  $url = $_SERVER['argv'][0];
              }
          }
  
          if (!isset($url[0]) || $url[0] !== '/') {
              $url = '/' . $url;
          }
          return $url;
      }
code_tokens: public static function getCurrentScriptName ( $ removePathInfo = true ) { $ url = '' ; // insert extra path info if proxy_uri_header is set and enabled if ( isset ( Config :: getInstance ( ) -> General [ 'proxy_uri_header' ] ) && Config :: getInstance ( ) -> General [ 'proxy_uri_header' ] == 1 && ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_URI' ] ) ) { $ url .= $ _SERVER [ 'HTTP_X_FORWARDED_URI' ] ; } if ( ! empty ( $ _SERVER [ 'REQUEST_URI' ] ) ) { $ url .= $ _SERVER [ 'REQUEST_URI' ] ; // strip http://host (Apache+Rails anomaly) if ( preg_match ( '~^https?://[^/]+($|/.*)~D' , $ url , $ matches ) ) { $ url = $ matches [ 1 ] ; } // strip parameters if ( ( $ pos = strpos ( $ url , "?" ) ) !== false ) { $ url = substr ( $ url , 0 , $ pos ) ; } // strip path_info if ( $ removePathInfo && ! empty ( $ _SERVER [ 'PATH_INFO' ] ) ) { $ url = substr ( $ url , 0 , - strlen ( $ _SERVER [ 'PATH_INFO' ] ) ) ; } } /**
           * SCRIPT_NAME is our fallback, though it may not be set correctly
           *
           * @see http://php.net/manual/en/reserved.variables.php
           */ if ( empty ( $ url ) ) { if ( isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) ) { $ url = $ _SERVER [ 'SCRIPT_NAME' ] ; } elseif ( isset ( $ _SERVER [ 'SCRIPT_FILENAME' ] ) ) { $ url = $ _SERVER [ 'SCRIPT_FILENAME' ] ; } elseif ( isset ( $ _SERVER [ 'argv' ] ) ) { $ url = $ _SERVER [ 'argv' ] [ 0 ] ; } } if ( ! isset ( $ url [ 0 ] ) || $ url [ 0 ] !== '/' ) { $ url = '/' . $ url ; } return $ url ; }
docstring: Returns the path to the script being executed. Includes the script file name.
  
  @param bool $removePathInfo If true (default value) then the PATH_INFO will be stripped.
  @return string eg, `"/dir1/dir2/index.php"` if the current URL is
  `"http://example.org/dir1/dir2/index.php?param1=value1&param2=value2"`
  @api
docstring_tokens: Returns the path to the script being executed . Includes the script file name .