diff --git a/include/ajax.tasks.php b/include/ajax.tasks.php index cd85cf613cbf696280ae79182946d6c9e6b46fea..77038e4c52af0e509bfd8462b468988e9bc6cd1b 100644 --- a/include/ajax.tasks.php +++ b/include/ajax.tasks.php @@ -130,8 +130,11 @@ class TasksAjaxAPI extends AjaxController { $note = array( 'title' => __('Task Created From Thread Entry'), - 'note' => __('Task ' . $taskLink . - '<br /> Thread Entry: ' . $entryLink) + 'note' => sprintf(__( + // %1$s is the task ID number and %2$s is the thread + // entry date + 'Task %1$s<br/> Thread Entry: %2$s'), + $taskLink, $entryLink) ); $originalTask->postNote($note, $errors, $thisstaff); @@ -143,7 +146,7 @@ class TasksAjaxAPI extends AjaxController { $note = array( 'title' => __('Task Created From Thread Entry'), - 'note' => __('This Task was created from Task ' . $taskLink)); + 'note' => sprintf(__('This Task was created from Task %1$s'), $taskLink)); $task->postNote($note, $errors, $thisstaff); } diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 099d9ecafe64ac75e6edd163bcf4c15a31ba30d7..3b26b91fea5bae8ca62ee1f0d4a11d906f6a424d 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -1499,8 +1499,11 @@ function refer($tid, $target=null) { $note = array( 'title' => __('Task Created From Thread Entry'), - 'body' => __('Task ' . $taskLink . - '<br /> Thread Entry: ' . $entryLink) + 'body' => sprintf(__( + // %1$s is the task ID number and %2$s is the thread + // entry date + 'Task %1$s<br/> Thread Entry: %2$s'), + $taskLink, $entryLink) ); $ticket->logNote($note['title'], $note['body'], $thisstaff); @@ -1512,7 +1515,8 @@ function refer($tid, $target=null) { $note = array( 'title' => __('Task Created From Thread Entry'), - 'note' => __('This Task was created from Ticket ' . $ticketLink)); + 'note' => sprintf(__('This Task was created from Ticket %1$s', $ticketLink)) + ); $task->postNote($note, $errors, $thisstaff); } diff --git a/include/class.ticket.php b/include/class.ticket.php index a3f33f0521c2bb510b7e6a24fd07145c6b14b577..0ac205d138a8210b8b114e77c5ebdfd05df01bbd 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -3955,8 +3955,10 @@ implements RestrictedAccess, Threadable, Searchable { $note = array( 'title' => __('Ticket Created From Thread Entry'), - 'body' => sprintf(__('This Ticket was created from %s '. $link), - $oldTicket ? 'Ticket' : 'Task') + 'body' => sprintf(__( + // %1$s is the word Ticket or Task, %2$s will be a link to it + 'This Ticket was created from %1$s %2$s'), + $oldTicket ? __('Ticket') : __('Task'), $link) ); $ticket->logNote($note['title'], $note['body'], $thisstaff); @@ -3973,13 +3975,15 @@ implements RestrictedAccess, Threadable, Searchable { $ticketNote = array( 'title' => __('Ticket Created From Thread Entry'), - 'body' => __('Ticket ' . $ticketLink). - '<br /> Thread Entry: ' . $entryLink); + 'body' => sprintf(__('Ticket %1$s<br/> Thread Entry: %2$s'), + $ticketLink, $entryLink) + ); $taskNote = array( 'title' => __('Ticket Created From Thread Entry'), - 'note' => __('Ticket ' . $ticketLink). - '<br /> Thread Entry: ' . $entryLink); + 'note' => sprintf(__('Ticket %1$s<br/> Thread Entry: %2$s'), + $ticketLink, $entryLink) + ); if ($oldTicket) $oldTicket->logNote($ticketNote['title'], $ticketNote['body'], $thisstaff); diff --git a/include/cli/modules/i18n.php b/include/cli/modules/i18n.php index 2adb14a9051d758dfd678631f3fe3fa37dcaa330..44ce45897ba6f6570579189667c24b06bdaba9c1 100644 --- a/include/cli/modules/i18n.php +++ b/include/cli/modules/i18n.php @@ -637,7 +637,7 @@ class i18n_Compiler extends Module { ); $root = realpath($options['root'] ?: ROOT_DIR); $domain = $options['domain'] ? '('.$options['domain'].')/' : ''; - $files = Test::getAllScripts(true, $root); + $files = Test::getAllScripts("*.php", $root); $strings = array(); foreach ($files as $f) { $F = str_replace($root.'/', $domain, $f); diff --git a/setup/test/tests/class.test.php b/setup/test/tests/class.test.php index 1c4f1b5255d444fc60cc264428621f5745c498b4..8eec8a753a3d988f3b20b8eeeacd36ee8b6e73e2 100644 --- a/setup/test/tests/class.test.php +++ b/setup/test/tests/class.test.php @@ -31,13 +31,13 @@ class Test { function teardown() { } - function ignore3rdparty() { + static function ignore3rdparty() { return true; } - function getAllScripts($pattern='*.php', $root=false, $excludes=true) { + static function getAllScripts($pattern='*.php', $root=false, $excludes=true) { $root = $root ?: get_osticket_root_path(); - $excludes = $excludes ?: $this->ignore3rdparty(); + $excludes = $excludes ?: static::ignore3rdparty(); $scripts = array(); foreach (glob_recursive("$root/$pattern") as $s) { $found = false; diff --git a/setup/test/tests/test.extra-whitespace.php b/setup/test/tests/test.extra-whitespace.php index ff3fc7be0721cd981de6550ba051a540565c6b28..2565de6813510972794240d5752a1db9a2db4185 100644 --- a/setup/test/tests/test.extra-whitespace.php +++ b/setup/test/tests/test.extra-whitespace.php @@ -5,7 +5,7 @@ class ExtraWhitespace extends Test { var $name = "PHP Leading and Trailing Whitespace"; function testFindWhitespace() { - foreach ($this->getAllScripts() as $s) { + foreach (static::getAllScripts() as $s) { $matches = array(); $content = file_get_contents($s); if (preg_match_all('/^\s+<\?php|\?>\n\s+$/s', diff --git a/setup/test/tests/test.git-conflicts.php b/setup/test/tests/test.git-conflicts.php index 5aa27bfb951a0d43d5eb8df02fcdbb31b5e05697..dde0621e333337148ae57c8c57c632d26a8c8126 100644 --- a/setup/test/tests/test.git-conflicts.php +++ b/setup/test/tests/test.git-conflicts.php @@ -6,7 +6,7 @@ class GitConflicts extends Test { function testFindGitConflicts() { $regex = '/^[\t ]*?<{3,} ?HEAD[\t ]*?|^[\t ]*?>{3,}[\t ]*?/m'; - foreach ($this->getAllScripts('*') as $s) { + foreach (static::getAllScripts('*') as $s) { $matches = array(); $content = file_get_contents($s); if (preg_match_all($regex, diff --git a/setup/test/tests/test.jslint.php b/setup/test/tests/test.jslint.php index e916715c663587d14f20be9dc213011c00055d1a..038a9109f274a8fa4ca44952f6fc2901f251affc 100644 --- a/setup/test/tests/test.jslint.php +++ b/setup/test/tests/test.jslint.php @@ -6,7 +6,7 @@ class JsSyntaxTest extends Test { function testLintErrors() { $exit = 0; - foreach ($this->getAllScripts('*.js') as $s) { + foreach (static::getAllScripts('*.js') as $s) { ob_start(); system("jsl -process $s", $exit); $line = ob_get_contents(); diff --git a/setup/test/tests/test.shortopentags.php b/setup/test/tests/test.shortopentags.php index ec5b8669e454c6ae735aeb81fbfaba94f0f4e016..9aacbd94c9eb21f9f94a7b15111fe507bbdb24b1 100644 --- a/setup/test/tests/test.shortopentags.php +++ b/setup/test/tests/test.shortopentags.php @@ -5,7 +5,7 @@ class ShortOpenTag extends Test { var $name = "PHP Short Open Checks"; function testFindShortOpens() { - foreach ($this->getAllScripts() as $s) { + foreach (static::getAllScripts() as $s) { $matches = array(); $content = file_get_contents($s); if (preg_match_all('/<\?\s*(?!php|xml).*$/m', diff --git a/setup/test/tests/test.signals.php b/setup/test/tests/test.signals.php index 0f6287a0a9e0a8414d39cecacdf2a2ed99704964..0176bf0cc2de42561894fa40f2bb7768d63a2159 100644 --- a/setup/test/tests/test.signals.php +++ b/setup/test/tests/test.signals.php @@ -8,7 +8,7 @@ class SignalsTest extends Test { * Ensures that each signal subscribed to has a sender somewhere else */ function testFindSignalPublisher() { - $scripts = $this->getAllScripts(); + $scripts = static::getAllScripts(); $matches = $published_signals = array(); foreach ($scripts as $s) if (preg_match_all("/^ *Signal::send\('([^']+)'/m", diff --git a/setup/test/tests/test.syntax.php b/setup/test/tests/test.syntax.php index cc528f52fb53b8174caf96a61652c11f29bde818..38bb5accab0a0cb7d4a216a844dd4c8773eb01b3 100644 --- a/setup/test/tests/test.syntax.php +++ b/setup/test/tests/test.syntax.php @@ -4,13 +4,13 @@ require_once "class.test.php"; class SyntaxTest extends Test { var $name = "PHP Syntax Checks"; - function ignore3rdparty() { + static function ignore3rdparty() { return false; } function testCompileErrors() { $exit = 0; - foreach ($this->getAllScripts() as $s) { + foreach (static::getAllScripts() as $s) { ob_start(); system("php -l $s", $exit); $line = ob_get_contents(); diff --git a/setup/test/tests/test.undefinedmethods.php b/setup/test/tests/test.undefinedmethods.php index 16f4e76e1678ac5e755e4c23235a5279e348cb03..aaba663402cf55a41f2588c4a9311f18af0634df 100644 --- a/setup/test/tests/test.undefinedmethods.php +++ b/setup/test/tests/test.undefinedmethods.php @@ -4,12 +4,12 @@ require_once "class.test.php"; class UndefinedMethods extends Test { var $name = "Access to undefined object methods"; - function ignore3rdparty() { + static function ignore3rdparty() { return false; } function testUndefinedMethods() { - $scripts = $this->getAllScripts(); + $scripts = static::getAllScripts(); $function_defs = array(); foreach ($scripts as $s) { $matches = array(); diff --git a/setup/test/tests/test.unitialized.php b/setup/test/tests/test.unitialized.php index 47978fdb2fd9741bd2c4f554d527795a4927cbed..dc10af0fb10bfbf11050120f7f4bf36308c11b4a 100644 --- a/setup/test/tests/test.unitialized.php +++ b/setup/test/tests/test.unitialized.php @@ -6,7 +6,7 @@ class UnitializedVars extends Test { var $name = "Access to unitialized variables"; function testUnitializedUsage() { - $scripts = $this->getAllScripts(); + $scripts = static::getAllScripts(); $matches = array(); foreach ($scripts as $s) { $a = new SourceAnalyzer($s); diff --git a/setup/test/tests/test.var-dump.php b/setup/test/tests/test.var-dump.php index 1244ec7b5e1c1e95e037946d105ae70cf8a92fdf..d87f393e580fcbe7f74d480f35c11e18ad623f34 100644 --- a/setup/test/tests/test.var-dump.php +++ b/setup/test/tests/test.var-dump.php @@ -6,7 +6,7 @@ class VarDump extends Test { function testFindShortOpens() { $re = '/^(([\t ]*?)var_dump\(.*[\)|,|;])((?!nolint).)*$/m'; - foreach ($this->getAllScripts() as $s) { + foreach (static::getAllScripts() as $s) { $matches = array(); $content = file_get_contents($s); if (preg_match_all($re,