Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $info = explode("\n", $nfo);
- $tags = array('games' => array('text' => 'Games',
- 'genres' => array('keywords' => array('genre', 'game type'),
- 'options' => array('action', 'adventure', 'dance'),
- ),
- ),
- 'books' => array('text' => 'Books',
- 'genres' => array('keywords' => array('genre', 'book type'),
- 'options' => array('suspense', 'romance', 'fiction'),
- ),
- ),
- 'music' => array('text' => 'Music',
- 'genres' => array('keywords' => array('genre', 'music type'),
- 'options' => array('rap', 'country', 'blues', 'jazz'),
- ),
- ),
- );
- unset($tags);
- foreach ($info as $index => $infoLine)
- {
- foreach ($tags as $genre => $genreData)
- {
- $tags .= (($tags) ? ',' : '') . $genreData['text'];
- foreach ($genreData['genres'] as $index => $genreOptions)
- {
- $keywords = $genreOptions['keywords'];
- $options = $genreOptions['options'];
- foreach ($keywords as $index => $keyword)
- {
- if (strpos($infoLine, $keyword) === true)
- {
- foreach ($options as $index => $option)
- {
- if (strpos($infoLine, $option) === true)
- {
- $tags .= (($tags) ? ',' : '') . ucwords($option);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement