コード例 #1
0
ファイル: tests.php プロジェクト: oscarholmedo/googl-php
    } else {
        println('Passed!');
    }
}
function assert_url($is)
{
    if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $is)) {
        exit(1);
    } else {
        println('Passed!');
    }
}
function println($text)
{
    echo $text . "\n";
}
require 'Googl.class.php';
#
# IMPORTANT: Please add your API key to make the tests work
#
$googl = new Googl('YOUR_API_KEY');
println('#1 - Assert that shortening http://www.google.ch results in an URL');
assert_url($googl->shorten('http://www.google.ch'));
println('#2 - Assert that expanding http://goo.gl/KSggQ resolves to http://www.google.com/');
assert_equals($googl->expand('http://goo.gl/KSggQ'), 'http://www.google.com/');
println('#3 - Assert that shortening https://www.facebook.com results in an URL');
assert_url($googl->shorten('https://www.facebook.com'));
println('#4 - Assert that expanding http://goo.gl/wCWWd resolves to http://www.php.net/');
assert_equals($googl->expand('http://goo.gl/wCWWd'), 'http://www.php.net/');
# If this point is reached, all tests have passed
println('All tests have successfully passed!');
コード例 #2
0
ファイル: layout.php プロジェクト: MenZil-Team/inews
echo assert_url('/static/validator.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo assert_url('/static/essage.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo assert_url('/static/app.js');
?>
"></script>
<?php 
if ($user && $user->isAdmin()) {
    ?>
    <script type="text/javascript" src="<?php 
    echo assert_url('/static/admin.js');
    ?>
"></script>
<?php 
}
if (!empty($config['ga'])) {
    ?>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', '<?php 
    echo $config['ga'];
    ?>
']);
        _gaq.push(['_trackPageview']);

        (function () {
コード例 #3
0
ファイル: index.php プロジェクト: MenZil-Team/inews
            <div>
                <input type="submit" value="Confirm and Install the application"/>
            </div>
        </form>
    </div>
</div>

<footer class="wrapper">
    Powered by <a href="http://inews.io" title="inews.io">iNews.io</a>.&nbsp;
</footer>

<script type="text/javascript" src="<?php 
echo assert_url('/static/jquery-1.9.1.min.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo assert_url('/static/validator.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo assert_url('/static/essage.js');
?>
"></script>
<script type="text/javascript" src="<?php 
echo assert_url('/install/static/app.js');
?>
"></script>
</body>
</html>