3 * sac-a-push - Obj/transports.phh
5 * Copyright (C) 2012 Matteo Nastasi
6 * mailto: nastasi@alternativeoutput.it
7 * matteo.nastasi@milug.org
8 * web: http://www.alternativeoutput.it
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details. You should have received a
19 * copy of the GNU General Public License along with this program; if
20 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21 * Suite 330, Boston, MA 02111-1307, USA.
25 class Transport_template {
27 function Transport_template() {
30 function init($enc, &$header_out, $init_string, $base, $step)
34 static function fini($init_string, $blockerr)
38 function chunk($step, $cont)
45 function Transport_xhr() {
48 function init($enc, &$header_out, $init_string, $base, $step)
52 $header_out['Content-Encoding'] = $enc;
53 $header_out['Cache-Control'] = 'no-cache, must-revalidate'; // HTTP/1.1
54 $header_out['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // Date in the past
55 $header_out['Content-type'] = 'application/xml; charset="utf-8"';
60 static function fini($init_string, $blockerr)
65 function chunk($step, $cont)
67 return ("@BEGIN@".$cont."@END@");
71 class Transport_iframe {
73 function Transport_iframe() {
76 function init($enc, &$header_out, $init_string, $base, $step)
81 $header_out['Content-Encoding'] = $enc;
82 $header_out['Cache-Control'] = 'no-cache, must-revalidate'; // HTTP/1.1
83 $header_out['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // Date in the past
84 $header_out['Content-type'] = 'text/html; charset="utf-8"';
86 $ret .= sprintf("<html>
88 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
89 <script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
90 <script type=\"text/javascript\">
91 var xynt_streaming = \"ready\";", $base, $base);
93 $ret .= sprintf("last_clean = %d;\n", ($step-1));
95 window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
99 $ret .= sprintf("<!-- \n%s -->\n", $init_string);
104 static function fini($init_string, $blockerr)
107 $ret .= sprintf("<html>
109 <script type=\"text/javascript\" src=\"%scommons.js\"></script>
110 <script type=\"text/javascript\" src=\"%sxynt-streaming-ifra.js\"></script>
111 <script type=\"text/javascript\">
112 var xynt_streaming = \"ready\";", self::base_get(), self::base_get());
114 window.onload = function () { if (xynt_streaming != \"ready\") { xynt_streaming.reload(); } };
118 $ret .= sprintf("<!-- \n%s -->\n", $init_string);
119 $ret .= sprintf("<script id='hs%d' type='text/javascript'><!--
122 </script>", 0, escpush($blockerr) );
126 function chunk($step, $cont)
129 return sprintf("<script id='hs%d' type='text/javascript'><!--
130 push(null);\n// -->\n</script>", $step);
133 return sprintf("<script id='hs%d' type='text/javascript'><!--
134 push(\"%s\");\n// -->\n</script>", $step, escpush($cont) );