-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
81 lines (70 loc) · 2.32 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>LRTEditor demo</title>
<!-- this is for the highlighter. You can use anything you want -->
<script src="shjs/lang/sh_php.js"></script>
<script src="shjs/sh_main.min.js"></script>
<link rel="stylesheet" href="src/style.css" />
<link rel="stylesheet" href="shjs/sh_style.css" />
<!-- specific for our editor. Notice how the highlighter-config is only a callback -->
<script src="src/LRTEditor.js"></script>
<script src="src/LRTEditor.HighlightPlugin.js"></script>
<script src="src/LRTEditor.MinimalPlugin.js"></script>
<script src="src/LRTEditor.UndoPlugin.js"></script>
<script type="text/javascript">
window.addEventListener('load', function(){
LRTEditor.initialize(
document.getElementsByTagName('code')[0],
[LRTEditor_MinimalPlugin, LRTEditor_UndoPlugin, LRTEditor_HighlightPlugin],
{
highlightCallback: function(el){ sh_highlightElement(el, sh_languages['php']); },
}
);
});
</script>
<style type="text/css">
/* styles for this demo-page */
code
{
border: 1px solid #ddd;
margin: 10px;
}
</style>
<link rel="stylesheet" href="http://simonwhitaker.github.io/github-fork-ribbon-css/gh-fork-ribbon.css" />
</head>
<body>
<div class="github-fork-ribbon-wrapper right"><div class="github-fork-ribbon"><a href="https://github.com/SjonHortensius/LRTEditor">Fork me on GitHub</a></div></div>
<code><?php
class Stuff
{
/*
Important comment
*/
public static function countObjTypes( array $data, array $types )
{
# $return['Other'] = 0;
foreach ( ( array ) $data as $obj ) {
$set = false;
array_walk( $types, function( $type ) use ( $obj, &$return, &$set )
{
if ( is_a( $obj, $type ) ) {
$return[$type]++;
$set = true;
}
} );
}
return $return;
}
}
// An example of how to use it
$form = new Form( 'Form', 'post' );
$honeyPot1 = new HoneyPotField( time() );
$honeyPot1->validator( new Validator( new HoneyPotTimeRule( 'This form was filled in too quickly, assumed bot, please allow 2 seconds to fill in the form' ) ) );
$honeyPot2 = new HoneyPotField();
$honeyPot2->validator( new Validator( new EqualRule( 'This field was unexpectedly filled in, assumed bot', '' ) ) );
if( $form->isSubmitted() )
$form->validate( );
echo $form->render( ); // outputs the form + elements</code>
</body>
</html>