$match_flip = $matches_flip[1]; // 0 is french version $text = mv2txt($match_flip['text']); if (count($matches_pt) > 1) { // Multiple P/T found, first is day, other are night $text = $matches_pt[1]['pow'] . '/' . $matches_pt[1]['tou'] . "\n" . $text; } $card->flip($match_flip['name'], $match_flip['type'], $text); } // Face down $nbmoon = preg_match_all($reg_moon, $html, $matches_moon, PREG_SET_ORDER); if ($nbmoon > 0) { $match_moon = $matches_moon[1]; // 0 is french version $nbcolor = preg_match_all('#<img height=10 src=graph/manas/l(?<color>.).gif>#', $match_moon['colors'], $matches_colors, PREG_SET_ORDER); $ci = ''; if ($nbcolor > 0) { foreach ($matches_colors as $color) { $ci .= $color['color']; } } else { echo 'Color not found<br>'; } $text = mv2txt($match_moon['text']); if (isset($matches_moon[1]['pt'])) { $text = $matches_moon[1]['pow'] . '/' . $matches_moon[1]['tou'] . "\n" . $text; } $card->transform(card_name_sanitize($match_moon['name']), $ci, $match_moon['type'], $text, card_image_url($mv_ext_name . '/' . $mv_card_id . 'f')); } } }
function mv_planeswalker($text_nodes, $text_idx) { $text = $text_nodes->item($text_idx)->C14N(); $text = mv2txt($text) . "\n"; if (preg_match_all('/\\s*([+|-]?\\d*)\\s*(.*?)\\n/', $text, $matches, PREG_SET_ORDER)) { $text = ''; foreach ($matches as $match) { $text .= $match[1] . ': ' . $match[2] . "\n"; } } $loyalty = $text_nodes->item($text_idx + 1)->C14N(); if (preg_match('#Loyalty : (\\d*)#', $loyalty, $matches)) { $loyalty = $matches[1]; $text = $loyalty . "\n" . $text; } return $text; }