protect() публичный статический Метод

public static protect ( $action = '' )
Пример #1
0
 /**
  * @depends testBlocked
  */
 public function testBlock()
 {
     $this->mockGoodReferer();
     ob_start();
     \Nabble\SemaltBlocker\Blocker::protect();
     $output = ob_get_clean();
     $this->assertEmpty($output, 'Shouldn\'t output anything');
     $this->mockBadReferer();
     ob_start();
     \Nabble\SemaltBlocker\Blocker::protect();
     $output = ob_get_clean();
     $explodedExplanation = explode('%s', \Nabble\SemaltBlocker\Blocker::$explanation);
     $this->assertNotNull($output, 'Output shouldn\'t be null');
     $this->assertContains($explodedExplanation[0], $output, 'Should contain explanation');
     ob_start();
     \Nabble\SemaltBlocker\Blocker::protect('TEST_MESSAGE');
     $output = ob_get_clean();
     $this->assertNotNull($output, 'Output shouldn\'t be null');
     $this->assertContains('TEST_MESSAGE', $output, 'Should contain test message');
     ob_start();
     \Nabble\SemaltBlocker\Blocker::protect('http://www.google.com');
     $output = ob_get_clean();
     $this->assertNotNull($output, 'Output shouldn\'t be null');
     // @todo test headers
 }
Пример #2
0
 public function __bootstrap()
 {
     \Nabble\SemaltBlocker\Blocker::protect();
     Ajde_Event::register('TransactionModel', 'onPaid', [$this, 'onTransactionPaid']);
     Ajde_Event::register('TransactionModel', 'onCreate', [$this, 'onTransactionCreated']);
     if (UserModel::isTester() || UserModel::isAdmin()) {
         $providers = config('shop.transaction.providers');
         $providers[] = 'test';
         Config::set('shop.transaction.providers', $providers);
     }
     return true;
 }
Пример #3
0
<?php

require '../vendor/autoload.php';
\Nabble\SemaltBlocker\Blocker::protect();
const STATUS_GREEN = 2;
const STATUS_ORANGE = 3;
const STATUS_RED = 4;
?>
<html>
<head>
    <title>semalt-blocker debug console</title>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
    <style>
        section {
            margin: 100px 0;
        }

        form {
            margin: 0 0 50px;
        }

        input, button {
            padding: 10px;
            font-size: 18px;
            max-width: 100%;
        }

        input[name=url] {
            width: 30em;
        }