diff --git a/e107_plugins/comment_menu/comment_menu.php b/e107_plugins/comment_menu/comment_menu.php index 7d5f86d7c..e6ccf59f4 100644 --- a/e107_plugins/comment_menu/comment_menu.php +++ b/e107_plugins/comment_menu/comment_menu.php @@ -41,8 +41,7 @@ if (!defined('e107_INIT')) $cobj = e107::getComment(); -global $menu_pref; - +$menu_pref = e107::getConfig('menu')->getPref(); $data = $cobj->getCommentData(intval($menu_pref['comment_display'])); diff --git a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php index 11f0b2d90..e2535fa7c 100644 --- a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php @@ -18,7 +18,7 @@ function __construct() { - $this->gen = new convert; // TODO replace all usage with e107::getParser()->toDate(); + $this->gen = e107::getDate(); // TODO replace all usage with e107::getParser()->toDate(); // $this->forum_rules = forum_rules('check'); } @@ -902,7 +902,7 @@ */ function sc_threadname($parm=null) { - global $menu_pref, $forum; + global $forum; $tp = e107::getParser(); $thread_name = strip_tags($tp->toHTML($this->var['thread_name'], false, 'no_hook, emotes_off')); @@ -922,6 +922,7 @@ $tip_length = $forum->prefs->get('tiplength', 400); if(strlen($thread_thread) > $tip_length) { + $menu_pref = e107::getConfig('menu')->getPref(); //$thread_thread = substr($thread_thread, 0, $tip_length).' '.$menu_pref['newforumposts_postfix']; $thread_thread = $tp->text_truncate($thread_thread, $tip_length, $menu_pref['newforumposts_postfix']); // Doesn't split entities } diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index 12ed9606f..11a0e1bd7 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -327,7 +327,8 @@ e107::getLanguage()->bcDefs($bcDefs); function sc_lm_external_links($parm='') { - global $menu_pref, $login_menu_shortcodes, $LOGIN_MENU_EXTERNAL_LINK; + global $LOGIN_MENU_EXTERNAL_LINK; + $menu_pref = e107::getConfig('menu')->getPref(); $tp = e107::getParser(); require_once(e_PLUGIN."login_menu/login_menu_class.php"); @@ -359,7 +360,7 @@ e107::getLanguage()->bcDefs($bcDefs); { $lbox_item['link_id'] = $stackid . '_' . $num; e107::setRegistry('login_menu_linkdata', $lbox_item); - $ret .= $tp->parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $login_menu_shortcodes); + $ret .= $tp->parseTemplate($LOGIN_MENU_EXTERNAL_LINK, false, $this); } } diff --git a/e107_tests/tests/unit/e_dateTest.php b/e107_tests/tests/unit/e_dateTest.php index 152b227e1..a77e90d88 100644 --- a/e107_tests/tests/unit/e_dateTest.php +++ b/e107_tests/tests/unit/e_dateTest.php @@ -186,6 +186,11 @@ $actual = $this->dateObj->computeLapse($newer, $time, false, true, 'long'); $this->assertEquals("Just now", $actual); + // Test "Just now" on identical timestamps + $actual = $this->dateObj->computeLapse($older, $older, false, true, 'long'); + $this->assertEquals("Just now", $actual); + + // XXX Improve output /* $newer = strtotime("18 months ago"); $actual = $this->dateObj->computeLapse($newer, time(), false, true, 'short'); diff --git a/e107_tests/tests/unit/e_parseTest.php b/e107_tests/tests/unit/e_parseTest.php index 0e04bf331..00728da04 100644 --- a/e107_tests/tests/unit/e_parseTest.php +++ b/e107_tests/tests/unit/e_parseTest.php @@ -145,10 +145,16 @@ while($row = $sql->fetch()) public function testParseTemplateWithCoreAddonShortcodes() { + $shortcodeObject = e107::getScBatch('online', true); + + $expected = "lost"; + $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', false, $shortcodeObject); + $this->assertEquals($expected, $result); + e107::getPlugin()->uninstall('online'); $sc = e107::getScParser(); $sc->__construct(); - $sc->clearRegistered(); + // $sc->resetscClass('online', null); $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', false); $this->assertEmpty($result); @@ -162,11 +168,11 @@ while($row = $sql->fetch()) $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', false, $shortcodeObject); $this->assertEquals($expected, $result); - $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', false); + $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', true); $this->assertEmpty($result); - $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', true); - $this->assertEquals($expected, $result); + // $result = $this->tp->parseTemplate('{ONLINE_MEMBER_PAGE}', true); + // $this->assertEquals($expected, $result); } public function testParseTemplateWithNonCoreShortcodes()