Пример #1
0
 public function testString()
 {
     isLike('#t.st#i', 'TESTO');
     isNotLike('#teeest#i', 'TESTO');
     isContain('t', 'test');
     isNotContain('x', 'test');
 }
Пример #2
0
 public function testAddMeta()
 {
     $value = uniqid();
     $result = $this->helper->request(__METHOD__, array('test-header-addmeta' => array('meta' => 'somemeta1', 'value' => $value)));
     isSame(200, $result->code);
     isLike('#<meta name=[\'\\"]somemeta1[\'\\"] content=[\'\\"]' . $value . '[\'\\"]#ius', $result->body);
     $value = uniqid();
     $result = $this->helper->request(__METHOD__, array('test-header-addmeta' => array('meta' => '<meta name=\'somemeta2\' content=\'' . $value . '\' />')));
     isSame(200, $result->code);
     isLike('#<meta name=[\'\\"]somemeta2[\'\\"] content=[\'\\"]' . $value . '[\'\\"]#ius', $result->body);
 }
Пример #3
0
 public function testHtmlInput()
 {
     $html = val('100.50 uah')->htmlInput('usd', 'some-param');
     isLike('#<input\\s#', $html);
     // check important classes
     isLike('#simpleType#', $html);
     isLike('#simpleType-input#', $html);
     isLike('#simpleType-value#', $html);
     isLike('#simpleType-money#', $html);
     // attributes
     isLike('#name=\\"some-param\\"#', $html);
     isLike('#data-simpleType-id="\\d*"#', $html);
     isLike('#data-simpleType-value="8\\.04"#', $html);
     isLike('#data-simpleType-rule="usd"#', $html);
     isLike('#data-simpleType-orig-value="100\\.5"#', $html);
     isLike('#data-simpleType-orig-rule="uah"#', $html);
 }
Пример #4
0
        <div class="alert alert-success alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert">
                <span aria-hidden="true">&times;</span>
                <span class="sr-only">Close</span>
            </button>
            <small style="font-size:0.5em;"><? echo Yii::app()->user->getFlash('success'); ?></small>
        </div>
    <? } ?>
</div>

<div class="row  part-body">
    <? foreach ($viewModel as $key => $question) { ?>
        <div class="row">
            <div class="col-md-1 heart">
                <div class="row">
                    <? if (isLike($myLike, $question->id)) { ?>
                        <i class="icon-heart icon-2x" id="<? echo 'question' . $question->id ?>"
                           onclick="value('question',<? echo $question->id ?>, 1, 0)"></i>
                    <? } else { ?>
                        <i class="icon-heart-empty icon-2x" id="<? echo 'question' . $question->id ?>"
                           onclick="value('question',<? echo $question->id ?>, 0,0)"></i>
                    <? } ?>
                </div>
                <div class="row">
                    <span class="likeCount"
                          id="<? echo 'likequestionCount' . $question->id ?>"><? echo $question->likeCount; ?></span>
                </div>
            </div>
            <div class="col-md-1 answer">
                <div class="row">
                    <a href="<? echo '?r=question/view&qid='.$question->id.'#answer';?>">
Пример #5
0
<?php

//Check if the GET isn't empty
if (!empty($_GET['search'])) {
    //Define it
    $search = $_GET['search'];
    //Loop through all the clothes
    foreach (Clothes::$clothes as $cloth) {
        //Check if the cloth is like the one we searched
        if (isLike($cloth->getName(), $search)) {
            //Prints the name of the product
            echo ($cloth->isFeatured() ? "<span style='color:gold'>* </span>" : "") . "<b>Naam:</b> " . $cloth->getName() . "<br>";
            //Prints the Price of the product
            echo "<b>Prijs:</b> " . $cloth->getPrice() . "<br>";
            //Print the description of the product.
            echo "<b>Beschrijving:</b> " . $cloth->getDescription() . "<br><br>";
        }
    }
}
/**
 * @param $name: The name of the cloth
 * @param $like: The search keyword
 * @return if the cloth is like the keyword
 */
function isLike($name, $like)
{
    //Check if the name contains a char
    if (strpos($name, $like) !== false) {
        //Return yes
        return true;
    }
Пример #6
0
    <?php if (Yii::app()->user->hasFlash('success')) { ?>
        <div class="alert alert-success alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert">
                <span aria-hidden="true">&times;</span>
                <span class="sr-only">Close</span>
            </button>
            <small style="font-size:0.5em;"><? echo Yii::app()->user->getFlash('success'); ?></small>
        </div>
    <? } ?>
</div>

<div class="row part-body">
    <?php foreach ($viewModel as $key => $answer) { ?>
        <div class="row">
            <div class="col-md-2 heart">
                <? if (isLike($myLike, $answer->id)) { ?>
                    <i class="icon-heart icon-2x" id="<? echo 'answer' . $answer->id ?>"
                       onclick="value('answer',<? echo $answer->id ?>, 1, 0)"></i>
                <? } else { ?>
                    <i class="icon-heart-empty icon-2x" id="<? echo 'answer' . $answer->id ?>"
                       onclick="value('answer',<? echo $answer->id ?>, 0,0)"></i>
                <? } ?>
                <span>×</span>
                <span class="likeCount"
                      id="<? echo 'likeanswerCount' . $answer->id ?>"><? echo $answer->likeCount; ?></span>
            </div>
            <div class="col-md-10">
                <div class="row">
                    <div class="col-md-12">
                        <a class="quetitle"
                           href="<?php echo Yii::app()->createUrl('question/view', array('qid' => $answer->question->id)); ?>">