diff options
author | Phie <phie@phie.ovh> | 2019-02-22 02:49:20 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-02-22 02:49:46 +0300 |
commit | 3c1bd5c8aba516e9d832d618a6993cc9293b6132 (patch) | |
tree | e365dc696a08f35c5ce9f2d9cac3c314a3701182 /lib/Command | |
parent | bb0ab4d911f4eb47b792716b242386598d85949c (diff) |
search amoung keywords
Diffstat (limited to 'lib/Command')
-rw-r--r-- | lib/Command/Search.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Command/Search.php b/lib/Command/Search.php index 2028d57..ea40754 100644 --- a/lib/Command/Search.php +++ b/lib/Command/Search.php @@ -117,9 +117,25 @@ private function search($relativePath, $folder, $query, $curDepth){ $this->writeFound($relativePath, $in); continue; } + try { $zipFile = new \PhpZip\ZipFile(); $zipFile->openFromStream($in->fopen("r")); + try { + $metadata = json_decode($zipFile->getEntryContents("metadata.json")); + $hasFound = false; + foreach($metadata->keywords as $keyword){ + if(strstr($this->removeAccents(strtolower($keyword)), $query)){ + $this->writeFound($relativePath,$in); + $hasFound = true; + break; + } + } + if($hasFound) + continue; + + } catch(Exception $e){ + } $index = $zipFile->getEntryContents("index.html"); if(strstr($this->removeAccents(strtolower($index)), $query)){ $this->writeFound($relativePath,$in); |