[communityhome] Fix formatting
parent
d352f6fa2a
commit
cc6108d9ca
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name: Community home
|
* Name: Community home
|
||||||
* Description: Show last community activity in homepage
|
* Description: Show last community activity in homepage
|
||||||
|
@ -10,20 +11,22 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
require_once('mod/community.php');
|
require_once 'mod/community.php';
|
||||||
|
|
||||||
|
function communityhome_install()
|
||||||
function communityhome_install() {
|
{
|
||||||
Addon::registerHook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
|
Addon::registerHook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
|
||||||
logger("installed communityhome");
|
logger("installed communityhome");
|
||||||
}
|
}
|
||||||
|
|
||||||
function communityhome_uninstall() {
|
function communityhome_uninstall()
|
||||||
|
{
|
||||||
Addon::unregisterHook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
|
Addon::unregisterHook('home_content', 'addon/communityhome/communityhome.php', 'communityhome_home');
|
||||||
logger("removed communityhome");
|
logger("removed communityhome");
|
||||||
}
|
}
|
||||||
|
|
||||||
function communityhome_getopts() {
|
function communityhome_getopts()
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
'hidelogin' => L10n::t('Hide login form'),
|
'hidelogin' => L10n::t('Hide login form'),
|
||||||
'showlastusers' => L10n::t('Show last new users'),
|
'showlastusers' => L10n::t('Show last new users'),
|
||||||
|
@ -60,8 +63,8 @@ function communityhome_addon_admin_post(&$a, &$b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function communityhome_home(&$a, &$o)
|
||||||
function communityhome_home(&$a, &$o){
|
{
|
||||||
// custom css
|
// custom css
|
||||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/communityhome/communityhome.css" media="all" />';
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/communityhome/communityhome.css" media="all" />';
|
||||||
|
|
||||||
|
@ -140,7 +143,8 @@ function communityhome_home(&$a, &$o){
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$profile_link' => $profile_link,
|
'$profile_link' => $profile_link,
|
||||||
'$photo' => $rr[$photo],
|
'$photo' => $rr[$photo],
|
||||||
'$photo_user' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
|
'$photo_user' => sprintf("%s (%s posts, %s contacts)", $rr['name'], ($rr['items'] ? $rr['items'] : '0'),
|
||||||
|
($rr['contacts'] ? $rr['contacts'] : '0'))
|
||||||
]);
|
]);
|
||||||
$aside['$activeusers_items'][] = $entry;
|
$aside['$activeusers_items'][] = $entry;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +202,8 @@ function communityhome_home(&$a, &$o){
|
||||||
GROUP BY `uri`
|
GROUP BY `uri`
|
||||||
ORDER BY `T1`.`created` DESC
|
ORDER BY `T1`.`created` DESC
|
||||||
LIMIT 0,10",
|
LIMIT 0,10",
|
||||||
$a->get_baseurl(),$a->get_baseurl()
|
$a->get_baseurl(),
|
||||||
|
$a->get_baseurl()
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
|
@ -219,7 +224,8 @@ function communityhome_home(&$a, &$o){
|
||||||
default:
|
default:
|
||||||
if ($rr['resource-id']) {
|
if ($rr['resource-id']) {
|
||||||
$post_type = L10n::t('photo');
|
$post_type = L10n::t('photo');
|
||||||
$m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
$m = [];
|
||||||
|
preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
|
||||||
$rr['plink'] = $m[1];
|
$rr['plink'] = $m[1];
|
||||||
} else {
|
} else {
|
||||||
$post_type = L10n::t('status');
|
$post_type = L10n::t('status');
|
||||||
|
@ -228,7 +234,6 @@ function communityhome_home(&$a, &$o){
|
||||||
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
|
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
|
||||||
|
|
||||||
$aside['$like_items'][] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
|
$aside['$like_items'][] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,17 +243,14 @@ function communityhome_home(&$a, &$o){
|
||||||
|
|
||||||
$o = '<h1>' . ((x($a->config, 'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "" ) . '</h1>';
|
$o = '<h1>' . ((x($a->config, 'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "" ) . '</h1>';
|
||||||
|
|
||||||
if(file_exists('home.html'))
|
if (file_exists('home.html')) $o = file_get_contents('home.html');
|
||||||
$o = file_get_contents('home.html');
|
|
||||||
|
|
||||||
if (Config::get('communityhome', 'showcommunitystream')) {
|
if (Config::get('communityhome', 'showcommunitystream')) {
|
||||||
$oldset = Config::get('system', 'community_page_style');
|
$oldset = Config::get('system', 'community_page_style');
|
||||||
if ($oldset == CP_NO_COMMUNITY_PAGE)
|
if ($oldset == CP_NO_COMMUNITY_PAGE) Config::set('system', 'community_page_style', CP_USERS_ON_SERVER);
|
||||||
Config::set('system','community_page_style', CP_USERS_ON_SERVER);
|
|
||||||
|
|
||||||
$o .= community_content($a, 1);
|
$o .= community_content($a, 1);
|
||||||
|
|
||||||
if ($oldset == CP_NO_COMMUNITY_PAGE)
|
if ($oldset == CP_NO_COMMUNITY_PAGE) Config::set('system', 'community_page_style', $oldset);
|
||||||
Config::set('system','community_page_style', $oldset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue