From 276d979157161e1a453c47e811cb2331686733c2 Mon Sep 17 00:00:00 2001 From: Yannick nsenga romeo Date: Tue, 9 Jan 2024 17:07:29 +0200 Subject: [PATCH] Adding target blank for external links --- modules/core/message_functions.php | 2 +- modules/developer/modules.php | 10 +++++----- modules/github/modules.php | 6 +++--- modules/nasa/modules.php | 2 +- modules/nux/modules.php | 2 +- tests/phpunit/modules/core/message_functions.php | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/core/message_functions.php b/modules/core/message_functions.php index 86cfe81bd6..f08031853d 100644 --- a/modules/core/message_functions.php +++ b/modules/core/message_functions.php @@ -67,7 +67,7 @@ function format_msg_text($str, $output_mod, $links=true) { $str = preg_replace("/(&(?!amp)[^;]+;)/", " $1", $str); if ($links) { $link_regex = "/((http|ftp|rtsp)s?:\/\/(%[[:digit:]A-Fa-f][[:digit:]A-Fa-f]|[-_\.!~\*';\/\?#:@&=\+$,%[:alnum:]])+)/m"; - $str = preg_replace($link_regex, "$1", $str); + $str = preg_replace($link_regex, "$1", $str); } $str = preg_replace("/ (&[^;]+;)/", "$1", $str); $str = str_replace('', ' ', $str); diff --git a/modules/developer/modules.php b/modules/developer/modules.php index f76f40284e..d298f0eca0 100644 --- a/modules/developer/modules.php +++ b/modules/developer/modules.php @@ -94,12 +94,12 @@ protected function output() { return '
'.$this->trans('Developer Documentation').'
'. '
'. 'There is not a lot of documentation yet, but there are a few resources available online. First is the module overview page at our website intended for developers interested in creating module sets.'. - '

   http://cypht.org/modules.html'. - '

Code Documentation for Cypht is auto-generated using Apigen and while '. + '

   http://cypht.org/modules.html'. + '

Code Documentation for Cypht is auto-generated using Apigen and while '. 'not yet complete, has a lot of useful information'. - '

   http://cypht.org/docs/code_docs/index.html'. + '

   http://cypht.org/docs/code_docs/index.html'. '

Finally there is a "hello world" module with lots of comments included in the project download and browsable at github'. - '

   https://github.com/cypht-org/cypht/tree/master/modules/hello_world'. + '

   https://github.com/cypht-org/cypht/tree/master/modules/hello_world'. '
'; } } @@ -180,7 +180,7 @@ protected function output() { 'Zend version'.$server_info['zend_version'].''. 'SAPI'.$server_info['sapi'].''. 'Enabled Modules'.str_replace(',', ', ', implode(',', $this->get('router_module_list'))).''. - 'Git version'.$server_info['branch_name'].' at revision '.$server_info['commit_hash'].' ('.$server_info['commit_date'].')'. + 'Git version'.$server_info['branch_name'].' at revision '.$server_info['commit_hash'].' ('.$server_info['commit_date'].')'. ''; } return ''; diff --git a/modules/github/modules.php b/modules/github/modules.php index 1d0fba6ec1..eb43cd6ac3 100644 --- a/modules/github/modules.php +++ b/modules/github/modules.php @@ -782,14 +782,14 @@ function github_parse_headers($data, $output_mod) { if (array_key_exists('actor', $data) && array_key_exists('login', $data['actor'])) { $from = $data['actor']['login']; - $from_link = sprintf(' - https://github.com/%s', $output_mod->html_safe($from), $output_mod->html_safe($from)); + $from_link = sprintf(' - https://github.com/%s', $output_mod->html_safe($from), $output_mod->html_safe($from)); } else { $from = '[No From]'; } if (array_key_exists('repo', $data) && array_key_exists('name', $data['repo'])) { $name = $data['repo']['name']; - $repo_link = sprintf(' - https://github.com/%s', $output_mod->html_safe($name), $output_mod->html_safe($name)); + $repo_link = sprintf(' - https://github.com/%s', $output_mod->html_safe($name), $output_mod->html_safe($name)); } else { $name = '[No Repo]'; @@ -837,7 +837,7 @@ function github_parse_payload($data, $output_mod) { } if (array_key_exists('url', $vals) && array_key_exists('sha', $vals)) { $url = str_replace(array('commits', 'https://api.github.com/repos'), array('commit', 'https://github.com'), $vals['url']); - $res .= sprintf('', + $res .= sprintf('', $output_mod->html_safe($url), $output_mod->html_safe($vals['sha'])); } $res .= ''; diff --git a/modules/nasa/modules.php b/modules/nasa/modules.php index d6b36b2255..f5ce09b58c 100644 --- a/modules/nasa/modules.php +++ b/modules/nasa/modules.php @@ -108,7 +108,7 @@ protected function output() { '" alt="'.$this->trans('Picture of the day').'" />'; } elseif ($data['media_type'] == 'video' && array_key_exists('url', $data)) { - $res .= '
YouTube
'; + $res .= '
YouTube
'; } } elseif (array_key_exists('url', $data) && preg_match("/jpg$/i", $data['url'])) { diff --git a/modules/nux/modules.php b/modules/nux/modules.php index bb9eb1aac0..5a0cd81325 100644 --- a/modules/nux/modules.php +++ b/modules/nux/modules.php @@ -312,7 +312,7 @@ class Hm_Output_nux_dev_news extends Hm_Output_Module { protected function output() { $res = '
'.$this->trans('Development Updates').'
'; foreach ($this->get('nux_dev_news', array()) as $vals) { - $res .= sprintf('', $this->html_safe($vals['hash']), $this->html_safe($vals['shash']), diff --git a/tests/phpunit/modules/core/message_functions.php b/tests/phpunit/modules/core/message_functions.php index 24b1e104ff..5c6895c925 100644 --- a/tests/phpunit/modules/core/message_functions.php +++ b/tests/phpunit/modules/core/message_functions.php @@ -44,8 +44,8 @@ public function test_format_msg_image() { public function test_format_msg_text() { $mod = new Hm_Output_Test(array('foo' => 'bar', 'bar' => 'foo'), array('bar')); $this->assertEquals("foo
\nbar
", format_msg_text("foo\nbar", $mod)); - $this->assertEquals('http://foo.com
', format_msg_text('http://foo.com', $mod)); - $this->assertEquals('http://foo.com]
', format_msg_text('http://foo.com]', $mod)); + $this->assertEquals('http://foo.com
', format_msg_text('http://foo.com', $mod)); + $this->assertEquals('http://foo.com]
', format_msg_text('http://foo.com]', $mod)); } /** * @preserveGlobalState disabled
%s'. + $res .= sprintf('
%s'. '%s%s%s