/** * BBCodes initialisation. Filling in message::regexp array * */ function init_bbcodes() { $this->regexp[0] = array(); $this->regexp[1] = array("#\\[b\\](.*?)\\[/b\\]#is" => '<span style="font-weight: bold">\\1</span>', "#\\[i\\](.*?)\\[/i\\]#is" => '<span style="font-style: italic">\\1</span>', "#\\[u\\](.*?)\\[/u\\]#is" => '<span style="text-decoration: underline">\\1</span>', "#\\[del\\](.*?)\\[/del\\]#is" => '<span style="text-decoration: line-through">\\1</span>', "#\\[url\\][\\s\n\r]*(((https?|ftp|ed2k|irc)://)[^ \"\n\r\t\\<]*)[\\s\n\r]*\\[/url\\]#is" => '<a href="\\1" target="_blank">\\1</a>', "#\\[url\\][\\s\n\r]*(www\\.[^ \"\n\r\t\\<]*?)[\\s\n\r]*\\[/url\\]#is" => '<a href="http://\\1" target="_blank">\\1</a>', "#\\[url\\][\\s\n\r]*((ftp)\\.[^ \"\n\r\t\\<]*?)[\\s\n\r]*\\[/url\\]#is" => '<a href="\\2://\\1" target="_blank">\\1</a>', "#\\[url=(\"|"|)(((https?|ftp|ed2k|irc)://)[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="\\2" target="_blank">\\6</a>', "#\\[url=(\"|"|)(www\\.[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="http://\\2" target="_blank">\\4</a>', "#\\[url=(\"|"|)((ftp)\\.[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="\\3://\\2" target="_blank">\\5</a>', "#\\[mailto\\][\\s\n\r]*([a-z0-9&\\-_.]+?@[\\w\\-]+\\.([\\w\\-\\.]+\\.)?[\\w]+)[\\s\n\r]*\\[/mailto\\]#is" => '<a href="mailto:\\1">\\1</a>', "#\\[mailto=(\"|"|)([a-z0-9&\\-_.]+?@[\\w\\-]+\\.([\\w\\-\\.]+\\.)?[\\w]+)(\"|"|)\\](.*?)\\[/mailto\\]#is" => '<a href="mailto:\\2">\\5</a>', "#\\[color=(\"|"|)([\\#\\w]*)(\"|"|)\\](.*?)\\[/color(.*?)\\]#is" => '<span style="color:\\2">\\4</span>', "#\\[size=(\"|"|)([0-9]*)(\"|"|)\\](.*?)\\[/size(.*?)\\]#is" => '<span style="font-size: \\2pt">\\4</span>', "#\\[align=(\"|"|)(left|right|center|justify)(\"|"|)\\](.*?)\\[/align(.*?)\\]#is" => '<div style="text-align: \\2">\\4</span>', "#\\[user\\]([\\d\\w]*?)\\[/user\\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&user=\\1">\\1</a> ] ', "#\\[user=([\\d\\w]*?)\\](.*?)\\[/user\\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&user=\\1">\\2</a> ] ', "#\\[hidden\\](.*?)\\[/hidden\\]#is" => return_hidden_bb_text()); $this->regexp[1] = array_merge(get_animated_to_array(), $this->regexp[1]); $this->regexp[2] = array("#[\\s\n\r]*\\[img\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\][\\s\n\r]*#is" => '<br /><img src="\\1.\\2" alt="" /><br />', "#[\\s\n\r]*\\[img=(\"|"|)(left|right)(\"|"|)\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\][\\s\n\r]*#is" => '<img src="\\4.\\5" alt="" align="\\2" />'); }
/** * BBCodes initialisation. Filling in message::regexp array * */ function init_bbcodes() { global $system, $lightbox_config; $addtolink = empty($system->config['addtolink']) ? '' : $system->config['addtolink']; if (empty($lightbox_config['iframe_width'])) { $lightbox_config['iframe_width'] = 420; } if (empty($lightbox_config['iframe_height'])) { $lightbox_config['iframe_height'] = 315; } $this->regexp[0] = array(); $this->regexp[1] = array("#\\[b\\](.*?)\\[/b\\]#is" => '<span style="font-weight: bold">\\1</span>', "#\\[(h[1-5])\\](.*?)\\[/(h[1-5])\\]#is" => '<\\1>\\2</\\3>', "#\\[i\\](.*?)\\[/i\\]#is" => '<span style="font-style: italic">\\1</span>', "#\\[u\\](.*?)\\[/u\\]#is" => '<span style="text-decoration: underline">\\1</span>', "#\\[del\\](.*?)\\[/del\\]#is" => '<span style="text-decoration: line-through">\\1</span>', "#\\[\\[ul\\]\\](.*?)\\[/\\[ul\\]\\]#is" => '<ul>\\1</ul>', "#\\[\\*\\](.*?)\\[/\\*\\]#is" => '<li>\\1</li>', "#\\[url\\][\\s\n\r]*(((https?|ftp|ed2k|irc)://|" . RCMS_ROOT_PATH . ")[^ \"\n\r\t\\<]*)[\\s\n\r]*\\[/url\\]#is" => '<a href="\\1" ' . $addtolink . '>\\1</a>', "#\\[url\\][\\s\n\r]*((" . RCMS_ROOT_PATH . ")[^ \"\n\r\t\\<]*)[\\s\n\r]*\\[/url\\]#is" => '<a href="\\1" >\\1</a>', "#\\[url\\][\\s\n\r]*(www\\.[^ \"\n\r\t\\<]*?)[\\s\n\r]*\\[/url\\]#is" => '<a href="http://\\1" >\\1</a>', "#\\[url\\][\\s\n\r]*((ftp)\\.[^ \"\n\r\t\\<]*?)[\\s\n\r]*\\[/url\\]#is" => '<a href="\\2://\\1" target="_blank">\\1</a>', "#\\[url=(\"|"|)(((https?|ftp|ed2k|irc)://)[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="\\2" ' . $addtolink . '>\\6</a>', "#\\[url=(\"|"|)((" . RCMS_ROOT_PATH . ")[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="\\2" >\\5</a>', "#\\[url=(\"|"|)(www\\.[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="http://\\2" >\\4</a>', "#\\[url=(\"|"|)((ftp)\\.[^ \"\n\r\t\\<]*?)(\"|"|)\\](.*?)\\[/url\\]#is" => '<a href="\\3://\\2" target="_blank">\\5</a>', "#\\[mailto\\][\\s\n\r]*([a-z0-9&\\-_.]+?@[\\w\\-]+\\.([\\w\\-\\.]+\\.)?[\\w]+)[\\s\n\r]*\\[/mailto\\]#is" => '<a href="mailto:\\1">\\1</a>', "#\\[mailto=(\"|"|)([a-z0-9&\\-_.]+?@[\\w\\-]+\\.([\\w\\-\\.]+\\.)?[\\w]+)(\"|"|)\\](.*?)\\[/mailto\\]#is" => '<a href="mailto:\\2">\\5</a>', "#\\[color=(\"|"|)([\\#\\w]*)(\"|"|)\\](.*?)\\[/color(.*?)\\]#is" => '<span style="color:\\2">\\4</span>', "#\\[size=(\"|"|)([0-9]*)(\"|"|)\\](.*?)\\[/size(.*?)\\]#is" => '<span style="font-size: \\2pt">\\4</span>', "#\\[align=(\"|"|)(left|right|center|justify)(\"|"|)\\](.*?)\\[/align(.*?)\\]#is" => '<div style="text-align: \\2">\\4</div>', "#\\[user\\]([\\d\\w]*?)\\[/user\\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&user=\\1">\\1</a> ] ', "#\\[user=([\\d\\w]*?)\\](.*?)\\[/user\\]#is" => ' [ <a href="' . RCMS_ROOT_PATH . '?module=user.list&user=\\1">\\2</a> ] ', "#\\[hidden\\](.*?)\\[/hidden\\]#is" => return_hidden_bb_text()); $this->regexp[1] = array_merge(get_animated_to_array(), $this->regexp[1]); $this->regexp[2] = array("#\\[img\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?|" . RCMS_ROOT_PATH . "[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\]#is" => !empty($lightbox_config['articles']) ? ' <a href="\\1.\\2" class="gallery" title="\\1.\\2"><img src="\\1.\\2" alt="\\2" width="' . $lightbox_config['width'] . 'px" style="padding: 5px;" /></a>' : '<img src="\\1.\\2" alt="\\2" style="padding: 5px;" />', "#\\[img=(\"|"|)([\\d\\w\\.]*?)(\"|"|)\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?|" . RCMS_ROOT_PATH . "[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\]#is" => !empty($lightbox_config['articles']) ? ' <a href="\\4.\\5" class="gallery" title="\\2"><img src="\\4.\\5" alt="\\2" width="' . $lightbox_config['width'] . 'px" style="padding: 5px;" /></a>' : '<img src="\\4.\\5" alt="\\2" style="padding: 5px;" />', "#\\[img=(\"|"|)(left|right)(\"|"|)\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?|" . RCMS_ROOT_PATH . "[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\]#is" => ' <img src="\\4.\\5" alt="\\5" align="\\2" style="padding: 5px;" /> ', "#\\[img=(\"|"|)(\\d+)(\"|"|)\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?|" . RCMS_ROOT_PATH . "[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\]#is" => ' <img src="\\4.\\5" alt="\\5" width="\\2px" /> ', "#\\[img=(\"|"|)(100%|[1-9]?[0-9]%)(\"|"|)\\][\\s\n\r]*([\\w]+?://[^ \"\n\r\t<]*?|" . RCMS_ROOT_PATH . "[^ \"\n\r\t<]*?)\\.(gif|png|jpe?g)[\\s\n\r]*\\[/img\\]#is" => ' <img src="\\4.\\5" alt="\\5" width="\\2" /> ', '#\\[youtube\\]\\s*[a-zA-Z\\/\\/:\\.]*youtube.com\\/watch\\?v=([a-zA-Z0-9\\-_]+)([a-zA-Z0-9\\/\\*\\-\\_\\?\\&\\;\\%\\=\\.]*)\\[/youtube\\]#is' => '<iframe width="' . $lightbox_config['iframe_width'] . '" height="' . $lightbox_config['iframe_height'] . '" src="https://www.youtube.com/embed/\\1" frameborder="0" allowfullscreen></iframe>'); }