Мой код:
Код: Выделить всё
function getLotoSecond() {
$html = file_get_contents_curl('URL__ADDRESS');
// List
$start = stripos($html, '[list]');
$end = stripos($html, '[/list]', $offset = $start);
$length = $end - $start;
$list = substr($html, $start, $length);
//--
// Regex
preg_match_all('(([0-9]|[1-9][0-9]))', $list, $matches);
$items = $matches[2];
//--
// Output
echo '[list]';
for($i = 0; $i < 7; $i++) {
if($i == 6) {
echo '[*]' . $items[$i] . '';
} else {
echo '[*]' . $items[$i] . '';
}
}
echo '[/list]';
//--
}
Код: Выделить всё
function main($atts) {
if($atts["type"] == "loto-prvy") {
getLotoFirst();
} else if($atts["type"] == "loto-druhy") {
getLotoSecond();
}
}
add_shortcode('tipo', 'main');
Подробнее здесь: https://stackoverflow.com/questions/737 ... efore-post
Мобильная версия