stringStartsWith() static public method

Works around a strange feature of Calibre where middle components of names are capitalized, eg "Aliette de Bodard" -> "Aliette De Bodard". The directory name uses the capitalized form, the book path stored in the DB uses the original form.
static public stringStartsWith ( string $haystack, string $needle ) : boolean
$haystack string String to be searched
$needle string String to search for
return boolean true if $haystack starts with $needle, case insensitive
コード例 #1
0
 /**
  * If the current resource belongs to the admin area caching will be disabled.
  *
  * This call must happen before own_config_middleware, because there the PHP 
  * session will be started, and cache-control must happen before that.
  */
 public function call()
 {
     $app = $this->app;
     $request = $app->request;
     $resource = $request->getResourceUri();
     foreach ($this->resources as $noCacheResource) {
         if (Utilities::stringStartsWith($resource, $noCacheResource)) {
             session_cache_limiter('nocache');
             $app->getLog()->debug('caching_middleware: caching disabled for ' . $resource);
             break;
         }
     }
     $this->next->call();
 }