Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
Revert old version
Browse files Browse the repository at this point in the history
Revert version 1.1.0
  • Loading branch information
lukasamd committed Nov 2, 2015
1 parent 2646285 commit cfce970
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
This plugin colorize usernames according to the groups settings.
<<<<<<< HEAD
It can format nicknames in:

* moderators list
Expand All @@ -10,3 +11,6 @@ It can format nicknames in:
* last posts author in search results
* announcements author
* etc
=======
It's very similar to "Username Styles" plugin, but it's faster and compatible for MyBB 1.6.
>>>>>>> parent of e65e44c... Version 1.1.0
149 changes: 148 additions & 1 deletion root/inc/plugins/styleUsernames.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ function styleUsernames_info()
'description' => $lang->styleUsernamesDesc,
'website' => 'https://lukasztkacz.com',
'author' => 'Lukasz "LukasAMD" Tkacz',
<<<<<<< HEAD
'authorsite' => 'https://lukasztkacz.com',
'version' => '1.2.0',
=======
'authorsite' => 'http://lukasztkacz.com',
'version' => '1.0.0',
>>>>>>> parent of e65e44c... Version 1.1.0
'guid' => '',
'compatibility' => '18*',
'codename' => 'style_usernames'
Expand Down Expand Up @@ -135,6 +140,7 @@ class styleUsernames
*/
public static function admin()
{
<<<<<<< HEAD
global $mybb, $lang;
$lang->load("styleUsernames");

Expand Down Expand Up @@ -198,6 +204,19 @@ public static function addToCache($username, $uid)
{
self::$cache['users'][$uid] = $username;
}
=======
global $plugins;

$plugins->hooks["global_end"][10]["styleUsernames_getModerators"] = array("function" => create_function('', 'global $plugins; $plugins->objects[\'styleUsernames\']->getModerators();'));
$plugins->hooks["pre_output_page"][10]["styleUsernames_parseUsernames"] = array("function" => create_function('&$arg', 'global $plugins; $plugins->objects[\'styleUsernames\']->parseUsernames($arg);'));
$plugins->hooks["build_forumbits_forum"][10]["styleUsernames_buildForumbits"] = array("function" => create_function('&$arg', 'global $plugins; $plugins->objects[\'styleUsernames\']->buildForumbits($arg);'));
$plugins->hooks["forumdisplay_announcement"][10]["styleUsernames_forumdisplayAnnouncement"] = array("function" => create_function('', 'global $plugins; $plugins->objects[\'styleUsernames\']->forumdisplayAnnouncement();'));
$plugins->hooks["forumdisplay_thread"][10]["styleUsernames_forumdisplayThread"] = array("function" => create_function('', 'global $plugins; $plugins->objects[\'styleUsernames\']->forumdisplayThread();'));
$plugins->hooks["search_results_thread"][10]["styleUsernames_searchThread"] = array("function" => create_function('', 'global $plugins; $plugins->objects[\'styleUsernames\']->searchThread();'));
$plugins->hooks["search_results_post"][10]["styleUsernames_searchPost"] = array("function" => create_function('', 'global $plugins; $plugins->objects[\'styleUsernames\']->searchPost();'));
$plugins->hooks["pre_output_page"][10]["styleUsernames_pluginThanks"] = array("function" => create_function('&$arg', 'global $plugins; $plugins->objects[\'styleUsernames\']->pluginThanks($arg);'));
}
>>>>>>> parent of e65e44c... Version 1.1.0

/**
* Change moderators usernames to Style Usernames code and get their ids.
Expand Down Expand Up @@ -233,7 +252,7 @@ public static function getModerators() {
*/
public static function parseUsernames(&$content) {
global $db, $cache;

// Parse users
self::$cache['users'] = array_unique(self::$cache['users']);
self::$cache['guests'] = array_unique(self::$cache['guests']);
Expand Down Expand Up @@ -291,7 +310,129 @@ public static function parseUsernames(&$content) {
}
}
}
<<<<<<< HEAD

=======

/**
* Style usernames on forums list
*
* @param array &$forum Reference to forum data
*/
public function buildForumbits(&$forum)
{
if ($forum['lastposteruid'] != 0)
{
$this->cache['users'][$forum['lastposteruid']] = $forum['lastposter'];
$forum['lastposter'] = "#STYLE_USERNAMES_UID{$forum['lastposteruid']}#";
}
else
{
$this->cache['guests'][] = $forum['lastposter'];
$forum['lastposter'] = "#STYLE_USERNAMES_UID{$forum['lastposter']}#";
}
}

/**
* Style usernames on announcements list
*/
public function forumdisplayAnnouncement()
{
global $announcement;

$this->cache['users'][$announcement['uid']] = $announcement['username'];
$sign = ">#STYLE_USERNAMES_UID{$announcement['uid']}#<";
$announcement['profilelink'] = str_replace(">{$announcement['username']}<", $sign, $announcement['profilelink']);
}

/**
* Style usernames on topics list
*/
public function forumdisplayThread()
{
global $thread;

if ($thread['username'])
{
$this->cache['users'][$thread['uid']] = $thread['username'];
$thread['username'] = "#STYLE_USERNAMES_UID{$thread['uid']}#";
}
else
{
$this->cache['guests'][] = $thread['threadusername'];
$thread['username'] = "#STYLE_USERNAMES_UID{$thread['threadusername']}#";
}

if ($thread['lastposteruid'] != 0)
{
$this->cache['users'][$thread['lastposteruid']] = $thread['lastposter'];
$thread['lastposter'] = "#STYLE_USERNAMES_UID{$thread['lastposteruid']}#";
}
else
{
$this->cache['guests'][] = $thread['lastposter'];
$thread['lastposter'] = "#STYLE_USERNAMES_UID{$thread['lastposter']}#";
}
}

/**
* Style usernames on topics list (search results)
*/
public function searchThread()
{
global $thread, $lastposterlink;

if ($thread['username'])
{
if ($thread['uid'] != 0)
{
$this->cache['users'][$thread['uid']] = $thread['username'];
$sign = ">#STYLE_USERNAMES_UID{$thread['uid']}#<";
$thread['profilelink'] = str_replace(">{$thread['username']}<", $sign, $thread['profilelink']);
}
else
{
$this->cache['guests'][] = $thread['username'];
$thread['profilelink'] = "#STYLE_USERNAMES_UID{$thread['username']}#";
}

}


if ($thread['lastposteruid'] != 0)
{
$this->cache['users'][$thread['lastposteruid']] = $thread['lastposter'];
$sign = ">#STYLE_USERNAMES_UID{$thread['lastposteruid']}#<";
$lastposterlink = str_replace(">{$thread['lastposter']}<", $sign, $lastposterlink);
}
else
{
$this->cache['guests'][] = $thread['lastposter'];
$lastposterlink = "#STYLE_USERNAMES_UID{$thread['lastposter']}#";
}
}

/**
* Style usernames on posts list (search results)
*/
public function searchPost()
{
global $post;

if ($post['uid'])
{
$this->cache['users'][$post['uid']] = $post['username'];
$sign = ">#STYLE_USERNAMES_UID{$post['uid']}#<";
$post['profilelink'] = str_replace(">{$post['username']}<", $sign, $post['profilelink']);
}
else
{
$this->cache['guests'][] = $post['username'];
$post['profilelink'] = "#STYLE_USERNAMES_UID{$post['username']}#";
}
}

>>>>>>> parent of e65e44c... Version 1.1.0
/**
* Say thanks to plugin author - paste link to author website.
* Please don't remove this code if you didn't make donate
Expand All @@ -301,8 +442,14 @@ public static function pluginThanks(&$content)
{
global $session, $lukasamd_thanks;

<<<<<<< HEAD
if (!isset($lukasamd_thanks) && $session->is_spider) {
$thx = '<div style="margin:auto; text-align:center;">This forum uses <a href="https://lukasztkacz.com">Lukasz Tkacz</a> MyBB addons.</div></body>';
=======
if (!isset($lukasamd_thanks) && $session->is_spider)
{
$thx = '<div style="margin:auto; text-align:center;">This forum uses <a href="http://lukasztkacz.com">Lukasz Tkacz</a> MyBB addons.</div></body>';
>>>>>>> parent of e65e44c... Version 1.1.0
$content = str_replace('</body>', $thx, $content);
$lukasamd_thanks = true;
}
Expand Down

0 comments on commit cfce970

Please sign in to comment.