This repository has been archived by the owner on Jul 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
163 lines (128 loc) · 3.13 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>danbeam.org :: PHP Bridge
</head>
<style type="text/css">
.wrapper
{
text-align: left;
border: 1px solid #d0d0d0;
height: 100%;
background: #ffffff;
background: rgba(255,255,255,0.88);
padding: 20px 40px;
width: 600px;
}
.wrapper h1, .wrapper h2, .wrapper h3, .wrapper h4, div.results, button
{
font-family: Georgia;
color: #333333;
}
.wrapper h1
{
margin: -20px -40px 0px -40px;
padding: 20px 40px;
background: #161616;
color: #d6d6d6;
border-bottom: 1px solid #e0e0e0;
font-variant: small-caps;
}
.wrapper h2
{
margin: 20px 0px 5px 0px;
padding: 0;
}
.wrapper h3
{
margin: 0;
font-weight: normal;
}
.wrapper h4
{
margin: 20px -40px -20px -40px;
padding: 10px;
text-align: center;
background: #161616;
color: #d6d6d6;
}
#results
{
background-color: #f0f0f0;
border: 1px solid #e0e0e0;
padding: 20px;
white-space: pre;
}
blockquote
{
white-space: pre;
font-family: "Lucida Console", Lucida, "Sans sefif", Helvetica;
font-size: 12px;
color: #ffffff;
background-color: #000000;
border: 1px solid #333333;
margin: 0;
padding: 10px 20px;
}
button
{
border: 1px solid #e0e0e0;
border-bottom-width: 0px;
padding: 6px 20px;
font-size: 14px;
margin-bottom: -1px;
}
.strike
{
text-decoration: line-through;
}
</style>
</head>
<body>
<div align="center">
<div class="wrapper">
<h1>A PHP Bridge</h1>
<h2>Hello!</h2>
<h3>Have you ever wanted to make a transparent proxy from JavaScript to PHP, so you can simply call PHP functions client-side?<br /><br />Me neither, but my nerdy evil twin told me it would be cool, so here it is!</h3>
<h2>Example</h2>
<h2>Results</h2>
<button id="doit">Do it!</button>
<button id="clear">Clear</button>
<div id="results"></div>
<h2>Dependencies</h2>
<h3>So I got un-lazy and wrote a fairly thorough AJAX class (only the 89 billionth in existence), so this code doesn't even require anything other than <a href="domready.js">DomReady</a> and either my <a href="xhrs.js">XHRS</a> (XHR Secure) class or your favorite AJAX method of choice (again, however, you'll have to change the code, =O).</h3>
<h4>© Dan Beam, 2010</h4>
</div>
</div>
<script type="text/javascript" src="domready.js"></script>
<script type="text/javascript" src="xhrs.js"></script>
<script type="text/javascript" src="phpbridge.js"></script>
<script>
function $( id ){ return document.getElementById( id ); }
DomReady.ready( function( )
{
$pb.load( 'Server', function( )
{
var serv = new Server( );
$( 'doit' ).onclick = function( )
{
$( 'results' ).innerHTML =
serv.argDump
(
1, // number
"hey", // string
true, // boolean
null, // null
[ 1, 2, 3 ], // array
{ "key" : "val" } // object
);
return false;
};
} );
$( 'clear' ).onclick = function( ){ $( 'results' ).innerHTML = ''; return false; };
// show source highlighting
sh_highlightDocument( );
} );
</script>
</body>
</html>