Просмотр поста

.
jimy
sorry long time not on.

i'll share mine
open bbcode.php

find
public function __invoke(ContainerInterface $container)

add
$this->db = $container->get(\PDO::class);


find
public function tags($var)

add
$var = $this->hashTag($var);


last add protected function
/* mod HashTag system by jimy ironyzm */
	/* author: jimy */
	protected function hashTag($var) {
		$HashTag = '/(?<!:|\s|&|"|\')(^|\s)#([-a-z0-9_-]{3,20})/si';
		$var = str_replace('>#','> #',$var);
		$var = preg_replace_callback($HashTag, function($tags) {
			$tg = htmlspecialchars(trim($tags[2]));
			return $tags[1].'<a href="'.$homeurl.'/page/?act=tags&amp;src='.$tg.'" title="'._t('In-Tags: '.$tags[0].'','system').'"><span class="tagcon">'.$tags[2].'</span></a>';
		},$var);
		
		$UserTag = '#(^|[\n\s])@([-a-z0-9_-]{3,20})#si';
		$var = preg_replace_callback($UserTag, function($name) {
			$tg = htmlspecialchars(trim($name[2]));
			$user = $this->db->prepare('SELECT * FROM `users` WHERE `name` = ? LIMIT 1');
			$user->execute([$tg]);
			if ($user->rowCount() > 0 && $this->user->isValid()) {
				$users = $user->fetchColumn();
				return $name[1].'<a href="'.$homeurl.'/profile/?user='.$users['id'].'" title="'.$name[0].'">'.$name[0].'</a>';
			} else {
				return $name[1] . '@' . $name[2];
			}
		},$var);
		return $var;
	}


then open your style.css
add
.tagcon {
	display: inline-block;
}
.tagcon:before {
	content: "#";
	font-size: 15px;
	margin-right:2px;
	font-style:italic;
}



note :
1. pls make new $act in root/page/index.php for getting tags list
2. usage = @jimy #handsome / both @jimy and #handsome will be link into user profile and page/?act=tags