/** * Replace the given music tag in the given article's intro text and text. * @param type $article article to replace music tags in * @param MusicTag $musicTag music tag to replace in article */ public static function replaceTagsWithReplacementContent($article, MusicTag $musicTag) { $search = $musicTag->getFullTag(); $replace = $musicTag->getReplacementContent(); $article->introtext = str_replace($search, $replace, $article->introtext); if (isset($article->text)) { $article->text = str_replace($search, $replace, $article->text); } }
private function indexMusicTag(FinderIndexerResult &$item, MusicTag $musicTag) { $musicTag->addConfiguration($this->configuration); $musicFolder = new MusicFolder($musicTag); if ($musicFolder->isExists()) { $sortByAsc = $musicTag->getConfiguration()->isSortByAsc(); $maxRows = $musicTag->getConfiguration()->getMaxRows(); $offset = $musicTag->getOffset(); $page = $musicTag->getPageNumber(); $totaloffset = $page * $maxRows + $offset; $musicItems = $musicFolder->getMusicItems($sortByAsc, $maxRows, $totaloffset); $baseUrl = $item->url . "#"; foreach ($musicItems as $musicItem) { $this->indexMusicItem($item, $baseUrl, $musicItem); } } }
/** * Handle a single music folder. * @param MusicTag $musicTag music tag to fill table for * @param MusicFolder $musicFolder music folder to fill table for * @param HtmlTable $htmlTable table to write to * @return boolean whether any relevant rows were written to the table */ private function handleSingleMusicFolder(MusicTag $musicTag, MusicFolder $musicFolder, AbstractHtmlTable $htmlTable) { if ($musicFolder->isExists()) { $sortByAsc = $musicTag->getConfiguration()->isSortByAsc(); $maxRows = $musicTag->getConfiguration()->getMaxRows(); $offset = $musicTag->getOffset(); $page = $musicTag->getPageNumber(); $totaloffset = $page * $maxRows + $offset; $musicItems = $musicFolder->getMusicItems($sortByAsc, $maxRows, $totaloffset); for ($count = 0; $count < count($musicItems); $count++) { $musicItem = $musicItems[$count]; $htmlTable->addData(array(self::DEFAULT_ROW, self::EXTENDED_INFO_ROW), $musicItem); } return count($musicItems) > 0; } return false; }