PK bTC p_hidelinks/PK T|VCz?
p_hidelinks/plugin.phpinfo['plugin'] = 'p_hidelinks';
$this->info['title'] = 'Скрываем ссылки';
$this->info['description'] = 'Плагин скрывает ссылки от незарегистрированных пользователей';
$this->info['author'] = 'Maximov';
$this->info['version'] = '0.3';
$this->events[] = 'GET_COMMENTS';
$this->events[] = 'GET_WALL_POSTS';
$this->events[] = 'GET_FORUM_POSTS';
$this->events[] = 'GET_FORUM_POST';
$this->events[] = 'GET_POSTS';
$this->events[] = 'GET_POST';
$this->config['Прятать ссылки от ГОСТЕЙ за текстом']=" [только для пользователей сайта] ";
$this->config['Сайты которые прятать от ВСЕХ']="rival1.ru|rival2.ru|rival3.ru";
$this->config['и вместо ссылок на них писать']=" [плохой сайт] ";
}
public function install(){ return parent::install(); }
public function upgrade(){ return parent::upgrade(); }
public function execute($event, $item){
parent::execute();
if ($event=='GET_COMMENTS' or $event=='GET_WALL_POSTS') {$content='content';}
else{$content='content_html';}
$inUser = cmsUser::getInstance();
if ($event=='GET_POST' or $event=='GET_FORUM_POST') {
if ($this->config['Сайты которые прятать от ВСЕХ']){
$bad = str_replace(".", "\.", $this->config['Сайты которые прятать от ВСЕХ']);
$item[$content]=preg_replace("!]+(".$bad.")[^<]+!i", "".$this->config['и вместо ссылок на них писать']."", $item[$content]);
}
if (!$inUser->id) {
$item[$content]=preg_replace('!".$this->config['Прятать ссылки от ГОСТЕЙ за текстом']."", $item[$content]);
}
}else{
for ($i=0; $iconfig['Сайты которые прятать от ВСЕХ']){
$bad = str_replace(".", "\.", $this->config['Сайты которые прятать от ВСЕХ']);
$item[$i][$content]=preg_replace("!]+(".$bad.")[^<]+!i", "".$this->config['и вместо ссылок на них писать']."", $item[$i][$content]);
}
if (!$inUser->id) {
$item[$i][$content]=preg_replace('!".$this->config['Прятать ссылки от ГОСТЕЙ за текстом']."", $item[$i][$content]);
}
}
}
return $item;
}
}
?>
PK bTC 0 p_hidelinks/PK T|VCz?
* p_hidelinks/plugin.phpPK ~ U