Skip to content

Commit 2491d18

Browse files
committed
update readme with instructions;
1 parent 9d86d7c commit 2491d18

File tree

6 files changed

+714
-624
lines changed

6 files changed

+714
-624
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nbproject/*
1+
nbproject/*

filter.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<?php
2-
3-
class filter_gistembed extends moodle_text_filter {
4-
5-
public function filter($text, array $options = array()) {
6-
$cnt = preg_match_all('/https?:\/\/gist\.github\.com\/(.*?)\/([a-f0-9]*)/', $text, $matches);
7-
if ($cnt) {
8-
for ($i=0; $i<$cnt; ++$i) {
9-
$script = '<script src="https://gist.github.com/' . $matches[1][$i] . '/' . $matches[2][$i] . '.js"></script>';
10-
$text = str_replace($matches[0][$i], $script, $text);
11-
}
12-
}
13-
return $text;
14-
}
15-
16-
}
17-
1+
<?php
2+
3+
class filter_gistembed extends moodle_text_filter {
4+
5+
public function filter($text, array $options = array()) {
6+
$cnt = preg_match_all('/https?:\/\/gist\.github\.com\/(.*?)\/([a-f0-9]*)/', $text, $matches);
7+
if ($cnt) {
8+
for ($i=0; $i<$cnt; ++$i) {
9+
$script = '<script src="https://gist.github.com/' . $matches[1][$i] . '/' . $matches[2][$i] . '.js"></script>';
10+
$text = str_replace($matches[0][$i], $script, $text);
11+
}
12+
}
13+
return $text;
14+
}
15+
16+
}
17+

lang/en/filter_gistembed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<?php
2-
1+
<?php
2+
33
$string['filtername'] = 'Gist Embed';

0 commit comments

Comments
 (0)