Пример #1
0
?>
		<br />

		<?php 
$testdomain = 'reddit.com/r/syracuse';
if (nebula_is_available($testdomain)) {
    echo '<a href="http://' . $testdomain . '" target="_blank">/r/Syracuse</a> is currently <strong style="color: green;">online</strong>.';
} else {
    echo '<a href="http://' . $testdomain . '" target="_blank">/r/Syracuse</a> is currently <strong style="color: red;">offline</strong>.';
}
?>
		<br /><br />

		<?php 
$characters = 'abcdefghijklmnopqrstuvwxyz';
$wordLength = rand(3, 8);
$randomString = '';
for ($i = 0; $i < $wordLength; $i++) {
    $randomString .= $characters[rand(0, strlen($characters) - 1)];
}
$testdomain = $randomString . '.com';
if (nebula_is_available($testdomain)) {
    echo '<a href="http://' . $testdomain . '" target="_blank">' . $testdomain . '</a> (a randomly generated domain) <strong style="color: green;">exists</strong>!';
} else {
    echo '<a href="http://' . $testdomain . '" target="_blank">' . $testdomain . '</a> (a randomly generated domain) <strong style="color: red;">does not exist</strong>.';
}
?>
		<br />

	</div><!--/columns-->
</div><!--/row-->
Пример #2
0
function placehold_it($width = 800, $height = 600, $text = false, $color = false)
{
    $override = apply_filters('pre_placehold_it', false, $width, $height, $text, $color);
    if ($override !== false) {
        return $override;
    }
    if (nebula_is_available('https://placehold.it')) {
        $text = $text ? '?text=' . str_replace(' ', '+', $text) : '';
        $color = $color ? str_replace('#', '', $color) . '/' : '';
        return 'https://placehold.it/' . $width . 'x' . $height . '/' . $color . $text;
    } else {
        return get_template_directory_uri() . '/images/x.png';
        //Placehold.it is not available.
    }
}