-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhighlight.php
More file actions
32 lines (28 loc) · 839 Bytes
/
highlight.php
File metadata and controls
32 lines (28 loc) · 839 Bytes
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
<?php
if ( !defined( 'VOCAL_CODE' ) ) {
die( 'nope' );
}
if ( !isset( $_POST['source'] ) || $_POST['source'] === '' ) {
return;
}
$source = $_POST['source'];
$language = isset( $_POST['lang'] ) ? $_POST['lang'] : 'text';
if ( $code !== '' ) {
require_once( 'geshi-1.0/src/geshi.php' );
$geshi = new GeSHi( $source, $language );
echo '<div class="vcSyntaxBox" id="highlighted-source">';
echo $geshi->parse_code();
echo '</div>';
}
?>
<script>
function talkBottonPressed() {
var sourceElement = document.getElementById( 'highlighted-source' );
window.vocalcode.walkAndTalk( sourceElement );
}
function stopBottonPressed() {
window.vocalcode.stop();
}
</script>
<button class="btn" id="talk-button" onclick="talkBottonPressed();">Talk</button>
<button class="btn" id="stop-button" onclick="stopBottonPressed();">Stop</button>