コード例 #1
0
ファイル: StrTest.php プロジェクト: spress/spress-import
 public function testToAscii()
 {
     $this->assertEquals('camion', Str::toAscii('camión'));
     $this->assertEquals('espana', Str::toAscii('españa'));
     $this->assertEquals('bash', Str::toAscii('баш'));
     $this->assertEquals('baSH', Str::toAscii('баШ'));
 }
コード例 #2
0
 /**
  * Process a resource item. e.g: an image.
  *
  * @param Item $item The item.
  */
 protected function processResourceItem(Item $item)
 {
     if ($this->fetchResources == false) {
         return;
     }
     $urlPath = $this->getPathFromPermalink($item->getPermalink());
     $baseName = basename($urlPath);
     $baseNameLength = strlen($baseName . '/');
     $pathWithoutBase = substr_replace($urlPath, '', -$baseNameLength, $baseNameLength);
     $relativePath = $this->assetsPath . '/' . $this->sanitizePath($pathWithoutBase . '/' . $baseName);
     $fileExists = file_exists($this->getSrcPath($relativePath));
     $binaryContent = $item->getContent();
     if ($item->getFetchPermalink() == true) {
         $binaryContent = $this->downloadResource($item->getPermalink());
     }
     $resultItem = new ResultItem($item->getPermalink(), $binaryContent, $fileExists);
     $resultItem->setRelativePath($relativePath);
     $resultItem->setPermalink(Str::deletePrefix($relativePath, 'content'));
     $this->resourceItems[] = $resultItem;
     $this->impotedItems[] = $resultItem;
 }