init() публичный Метод

Constructor
public init ( ) : void
Результат void
Пример #1
0
    /**
     * Constructor
     * @return void
     */
    public function init()
    {
        parent::init();
        if ($this->isFinished()) {
            return;
        }
        echo str_repeat(' ', 1024);
        echo "\n\n";
        ?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h2>Don't panic!</h2>
<script>
	document.domain = document.domain;
	var c = parent.<?php 
        echo $_GET['c'];
        ?>
;
	c.start();
	function p(d) {c.message(d);};
	window.onload = function() {c.stop();};
</script>
</body>
</html>
<?php 
    }
Пример #2
0
 /**
  * Constructor
  * @return void
  */
 public function init()
 {
     parent::init();
     if ($this->isFinished()) {
         return;
     }
     $this->out("\r\n", false);
 }
Пример #3
0
 /**
  * Constructor
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0');
     $this->header('Expires: ' . date('r', strtotime('+1 year')));
     echo "Welcome to SockJS!\n";
     $this->finish();
 }
Пример #4
0
 /**
  * Constructor
  * @return void
  */
 public function init()
 {
     parent::init();
     Crypt::randomInts32(1, function ($ints) {
         $this->opts['entropy'] = $ints[0];
         echo json_encode($this->opts);
         $this->finish();
     }, 9);
     $this->sleep(5, true);
 }
Пример #5
0
    /**
     * Constructor
     * @return void
     */
    public function init()
    {
        parent::init();
        if (isset($this->attrs->version)) {
            $this->version = $this->attrs->version;
        }
        $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0');
        $this->header('Expires: ' . date('r', strtotime('+1 year')));
        $html = '<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<script>
		document.domain = document.domain;
		_sockjs_onload = function(){SockJS.bootstrap_iframe();};
	</script>
	<script src="https://cdn.jsdelivr.net/sockjs/' . htmlentities($this->version, ENT_QUOTES, 'UTF-8') . '/sockjs.min.js"></script>
</head>
<body>
	<h2>Don\'t panic!</h2>
	<p>This is a SockJS hidden iframe. It\'s used for cross domain magic.</p>
</body>
</html>';
        $etag = 'W/"' . sha1($html) . '"';
        $this->header('ETag: ' . $etag);
        if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
            if ($_SERVER['HTTP_IF_NONE_MATCH'] === $etag) {
                $this->status(304);
                $this->removeHeader('Content-Type');
                $this->finish();
                return;
            }
        }
        $this->header('Content-Length: ' . strlen($html));
        echo $html;
        $this->finish();
    }