/**
 * Removes an element from an array if it contains specified string
 * OBS This requires the string_contain($string, $substring) function
 *
 * @author Patrik "Popeen" Johansson <*****@*****.**>
 *
 * @license https://raw.githubusercontent.com/Kakadua/PHP-Snippets/master/LICENSE Unlicense
 *
 * @link https://github.com/Kakadua/PHP-Snippets/
 *
 * @package Kakadua-PHP-Snippets
 *
 * @param array $array The array you want to clean
 * @param String $crap The string you want to look for
 *
 * @return array A neat and clean array
 *
 *	@version 1
 */
function clean_array_string_contain($array, $crap)
{
    //Requires string_contain()
    for ($i = 0; $i < count($array); $i++) {
        if (string_contain($array[$i], $crap)) {
            array_splice($array, $i, 1);
            $i--;
        }
    }
    return $array;
}
function load_show($title, $page)
{
    $raw = file_get_contents("http://www.oppetarkiv.se/etikett/titel/" . urlencode($title) . "/?sida={$page}&sort=tid_stigande&embed=true");
    $episodeRaw = get_between_all($raw, '<article class="svtUnit', 'article>');
    $return = array('last' => !string_contain($raw, 'Visa fler'), 'episodes' => array());
    foreach ($episodeRaw as $episode) {
        $temp = array();
        $temp['title'] = get_between($episode, 'alt="', '"');
        $temp['cover'] = 'http:' . get_between($episode, 'oaImg" src="', '"');
        $temp['year'] = get_between($episode, 'datetime="', '-');
        $temp['aired'] = get_between($episode, 'datetime="', 'T');
        $temp['url'] = 'http://www.oppetarkiv.se' . get_between($episode, ' href="', '"');
        array_push($return['episodes'], $temp);
    }
    return $return;
}