$dataStore = new \PBPanel\Util\DataStore(); $connection = new \PBPanel\Util\BotConnectionHandler($dataStore); $functions = new \PBPanel\Util\Functions($dataStore, $connection); $templates = new \PBPanel\Util\ComponentTemplates(); $botSettings = $functions->getIniArray('settings'); $requestQueue = preg_split('/\\n/', trim($functions->getOtherFile($dataStore->getVar('paths', 'youtubePlaylist')))); $defaultPlaylist = preg_split('/\\n/', trim($functions->getOtherFile($dataStore->getVar('paths', 'defaultYoutubePlaylist')))); $defaultPlaylistLength = 0; $requestQueueLength = 0; $requestQueueDataRows = ''; $defaultPlaylistDataRows = ''; foreach ($requestQueue as $item) { if (trim($item) == '') { continue; } if (preg_match('/(.*)\\s-\\s(.+?)$/', $functions->cleanYTVideoTitle($item), $matches)) { $requestQueueDataRows .= '<tr><td>' . ($requestQueueLength + 1) . '.</td><td>' . $matches[1] . '</td><td>' . $matches[2] . '</td></tr>'; ++$requestQueueLength; } else { $requestQueueDataRows .= '<tr><td colspan="2">Could not parse the song queue. Make sure the file location is correct in Extras->Preferences.</td></tr>'; break; } } foreach ($defaultPlaylist as $item) { if (trim($item) == '') { continue; } if (preg_match('/(.{1,11})\\s[0-9]+\\.\\s(.*)/', $functions->cleanYTVideoTitle($item), $matches)) { $defaultPlaylistDataRows .= '<tr><td>' . ($defaultPlaylistLength + 1) . '.</td><td>' . trim($matches[2]) . '</td><td><div class="btn-toolbar">' . $templates->botCommandButton('playsong ' . $matches[1], '<span class="fa fa-play"></span>', 'success btn-sm') . $templates->botCommandButton('defaultdelsong ' . str_replace('https://youtube.com/watch?v=', '', $matches[1]), '<span class="fa fa-trash"></span>', 'danger btn-sm') . $templates->botCommandButton('d !chat Youtube link for ' . $matches[2] . ' -> http://youtube.com/watch?v=' . $matches[1], 'Link In Chat', 'default btn-sm') . '</div></td></tr>'; ++$defaultPlaylistLength; } else {