diff options
| author | czaks <marcin@6irc.net> | 2013-07-20 17:28:34 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-07-20 17:28:34 -0400 |
| commit | 9f323ae65fb9370a93d1aaa869ab5edfbaca49cf (patch) | |
| tree | 926a464440df8a37509ae54165edefac4a89d874 /inc/display.php | |
| parent | f04566f6d30553560d5a69e25e38de72a60f297c (diff) | |
| parent | e8b693b0447e5a61f740b27c5f3a57f68d544342 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
templates/themes/sitemap/info.php
Diffstat (limited to 'inc/display.php')
| -rw-r--r-- | inc/display.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/inc/display.php b/inc/display.php index ba55903d..fe8bb048 100644 --- a/inc/display.php +++ b/inc/display.php @@ -241,6 +241,29 @@ function secure_link($href) { return $href . '/' . make_secure_link_token($href); } +function embed_html($link) { + global $config; + + foreach ($config['embedding'] as $embed) { + if ($html = preg_replace($embed[0], $embed[1], $link)) { + if ($html == $link) + continue; // Nope + + $html = str_replace('%%tb_width%%', $config['embed_width'], $html); + $html = str_replace('%%tb_height%%', $config['embed_height'], $html); + + return $html; + } + } + + if ($link[0] == '<') { + // Prior to v0.9.6-dev-8, HTML code for embedding was stored in the database instead of the link. + return $link; + } + + return 'Embedding error.'; +} + class Post { public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) { global $config; @@ -269,6 +292,9 @@ class Post { $this->root = $root; $this->mod = $mod; + if ($this->embed) + $this->embed = embed_html($this->embed); + if ($this->mod) // Fix internal links // Very complicated regex @@ -365,6 +391,9 @@ class Thread { $this->mod = $mod; $this->hr = $hr; + if ($this->embed) + $this->embed = embed_html($this->embed); + if ($this->mod) // Fix internal links // Very complicated regex |
