forked from PerJensen/elgg_connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikolai Shcherbin
committed
Jan 19, 2025
1 parent
3d6826a
commit 00fff9f
Showing
33 changed files
with
1,743 additions
and
804 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
Elgg Connect | ||
=========== | ||
Elgg Landing Theme | ||
================== | ||
 | ||
|
||
 | ||
|
||
## Features | ||
|
||
- Landing page with cover photo, latest users and groups | ||
- Optional sidebar with content on the activity page | ||
- Introduces group cover image and alternate layout of group profile page | ||
- New standard icons for groups and users that match the color scheme | ||
Responsive Elgg theme with landing page. | ||
|
||
Based on [Elgg Connect plugin](https://github.com/PerJensen/elgg_connect) | ||
|
||
## Note | ||
|
||
After installation, go to the theme options and make your selections | ||
## Features | ||
|
||
This directory must be named 'elgg_connect' in your Elgg mod folder. | ||
* Landing page with cover photo, latest users and groups | ||
* Optional sidebar with content on the activity page | ||
* New standard icons for groups and users that match the color scheme | ||
* Logo image on the topbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace wZm\ElggTheme\Actions; | ||
|
||
use Symfony\Component\HttpFoundation\File\UploadedFile; | ||
|
||
class CoverAction { | ||
|
||
public function __invoke(\Elgg\Request $request) { | ||
$asset = 'cover'; | ||
$upload = elgg_get_uploaded_file($asset); | ||
|
||
if (!$upload instanceof UploadedFile || !$upload->isValid()) { | ||
return elgg_error_response(elgg_echo('elgg_theme:settings:cover:invalid')); | ||
} | ||
|
||
$assets_dir = elgg_get_data_path() . '/elgg_theme/'; | ||
|
||
if (!is_dir($assets_dir)) { | ||
mkdir($assets_dir, 0755, true); | ||
} | ||
|
||
$target = elgg_get_data_path() . 'elgg_theme/' . $asset . '.png'; | ||
if (file_exists($target)) { | ||
unlink($target); | ||
} | ||
|
||
try { | ||
$upload->move(elgg_get_data_path() . 'elgg_theme/', $asset . '.png'); | ||
elgg_invalidate_caches(); | ||
elgg_clear_caches(); | ||
} catch (\Exception $ex) { | ||
return false; | ||
} | ||
|
||
return elgg_ok_response('', elgg_echo('elgg_theme:settings:cover:success')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace wZm\ElggTheme\Actions; | ||
|
||
use Symfony\Component\HttpFoundation\File\UploadedFile; | ||
|
||
class LogoAction { | ||
|
||
public function __invoke(\Elgg\Request $request) { | ||
$asset = 'logo'; | ||
$upload = elgg_get_uploaded_file($asset); | ||
|
||
if (!$upload instanceof UploadedFile || !$upload->isValid()) { | ||
return elgg_error_response(elgg_echo('elgg_theme:settings:cover:invalid')); | ||
} | ||
|
||
$assets_dir = elgg_get_data_path() . '/elgg_theme/'; | ||
|
||
if (!is_dir($assets_dir)) { | ||
mkdir($assets_dir, 0755, true); | ||
} | ||
|
||
$target = elgg_get_data_path() . 'elgg_theme/' . $asset . '.png'; | ||
if (file_exists($target)) { | ||
unlink($target); | ||
} | ||
|
||
try { | ||
$upload->move(elgg_get_data_path() . 'elgg_theme/', $asset . '.png'); | ||
elgg_invalidate_caches(); | ||
elgg_clear_caches(); | ||
} catch (\Exception $ex) { | ||
return false; | ||
} | ||
|
||
return elgg_ok_response('', elgg_echo('elgg_theme:settings:cover:success')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace wZm\ElggTheme; | ||
|
||
use Elgg\DefaultPluginBootstrap; | ||
|
||
class Bootstrap extends DefaultPluginBootstrap { | ||
/** | ||
* Executed during 'plugin_boot:before', 'system' event | ||
* | ||
* Allows the plugin to require additional files, as well as configure services prior to booting the plugin | ||
* | ||
* @return void | ||
*/ | ||
public function load() { | ||
|
||
} | ||
|
||
/** | ||
* Executed during 'plugin_boot:before', 'system' event | ||
* | ||
* Allows the plugin to register handlers for 'plugin_boot', 'system' and 'init', 'system' events, | ||
* as well as implement boot time logic | ||
* | ||
* @return void | ||
*/ | ||
public function boot() { | ||
|
||
} | ||
|
||
/** | ||
* Executed during 'init', 'system' event | ||
* | ||
* Allows the plugin to implement business logic and register all other handlers | ||
* | ||
* @return void | ||
*/ | ||
public function init() { | ||
elgg_register_esm('js/elgg_theme', elgg_get_simplecache_url('elgg_theme/settings.mjs')); | ||
} | ||
|
||
/** | ||
* Executed during 'ready', 'system' event | ||
* | ||
* Allows the plugin to implement logic after all plugins are initialized | ||
* | ||
* @return void | ||
*/ | ||
public function ready() { | ||
|
||
} | ||
|
||
/** | ||
* Executed during 'shutdown', 'system' event | ||
* | ||
* Allows the plugin to implement logic during shutdown | ||
* | ||
* @return void | ||
*/ | ||
public function shutdown() { | ||
|
||
} | ||
|
||
/** | ||
* Executed when plugin is activated, after 'activate', 'plugin' event and before activate.php is included | ||
* | ||
* @return void | ||
*/ | ||
public function activate() { | ||
|
||
} | ||
|
||
/** | ||
* Executed when plugin is deactivated, after 'deactivate', 'plugin' event and before deactivate.php is included | ||
* | ||
* @return void | ||
*/ | ||
public function deactivate() { | ||
|
||
} | ||
|
||
/** | ||
* Registered as handler for 'upgrade', 'system' event | ||
* | ||
* Allows the plugin to implement logic during system upgrade | ||
* | ||
* @return void | ||
*/ | ||
public function upgrade() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace wZm\ElggTheme\Menus; | ||
|
||
class SettingsManu { | ||
|
||
public function __invoke(\Elgg\Event $event) { | ||
if (!elgg_in_context('admin') || !elgg_is_admin_logged_in()) { | ||
return; | ||
} | ||
|
||
$current_route = elgg_get_current_route(); | ||
if (elgg_extract('segments', $current_route->getMatchedParameters()) !== 'plugins' && $current_route->getName() !== 'admin:plugin_settings') { | ||
return; | ||
} | ||
|
||
$menu = $event->getValue(); | ||
/* @var $menu \Elgg\Collections\Collection */ | ||
|
||
$menu->add(\ElggMenuItem::factory([ | ||
'name' => 'elgg_theme:config', | ||
'text' => elgg_echo('admin:elgg_theme:config'), | ||
'href' => elgg_normalize_url('admin/plugin_settings/elgg_theme'), | ||
'parent_name' => 'plugin:settings:elgg_theme', | ||
'section' => 'plugin_settings', | ||
])); | ||
|
||
$menu->add(\ElggMenuItem::factory([ | ||
'name' => 'elgg_theme:cover', | ||
'text' => elgg_echo('admin:elgg_theme:cover'), | ||
'href' => elgg_normalize_url('admin/elgg_theme/cover'), | ||
'parent_name' => 'plugin:settings:elgg_theme', | ||
'section' => 'plugin_settings', | ||
])); | ||
|
||
$menu->add(\ElggMenuItem::factory([ | ||
'name' => 'elgg_theme:logo', | ||
'text' => elgg_echo('admin:elgg_theme:logo'), | ||
'href' => elgg_normalize_url('admin/elgg_theme/logo'), | ||
'parent_name' => 'plugin:settings:elgg_theme', | ||
'section' => 'plugin_settings', | ||
])); | ||
|
||
return $menu; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "rivervanrain/elgg_theme", | ||
"type": "elgg-plugin", | ||
"description": "Responsive Elgg theme with landing page", | ||
"license": "AGPL-3.0-or-later", | ||
"keywords": ["theme", "landing"], | ||
"homepage": "https://wzm.me", | ||
"authors": [ | ||
{ | ||
"name": "Per Jensen" | ||
}, | ||
{ | ||
"name": "Nikolai Shcherbin", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"": "classes/" | ||
} | ||
}, | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://asset-packagist.org" | ||
} | ||
], | ||
"conflict": { | ||
"elgg/elgg": "<6.1", | ||
"elgg/custom_index": "*" | ||
}, | ||
"support": { | ||
"source": "https://github.com/rivervanrain/elgg_theme" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
/** | ||
* Elgg Landing Theme | ||
* @author Nikolai Shcherbin | ||
* @license GNU Affero General Public License version 3 | ||
* @copyright (c) Nikolai Shcherbin 2022 | ||
* @link https://wzm.me | ||
**/ | ||
|
||
return [ | ||
'plugin' => [ | ||
'name' => 'Elgg Landing Theme', | ||
'version' => '3.0.0', | ||
'dependencies' => [ | ||
'activity' => [ | ||
'position' => 'after', | ||
'must_be_active' => false, | ||
], | ||
'groups' => [ | ||
'position' => 'after', | ||
'must_be_active' => false, | ||
], | ||
], | ||
'activate_on_install' => true, | ||
], | ||
|
||
'bootstrap' => \wZm\ElggTheme\Bootstrap::class, | ||
|
||
'actions' => [ | ||
'admin/elgg_theme/cover' => [ | ||
'controller' => \wZm\ElggTheme\Actions\CoverAction::class, | ||
'access' => 'admin', | ||
], | ||
|
||
'admin/elgg_theme/logo' => [ | ||
'controller' => \wZm\ElggTheme\Actions\LogoAction::class, | ||
'access' => 'admin', | ||
], | ||
], | ||
|
||
'events' => [ | ||
'register' => [ | ||
'menu:page' => [ | ||
\wZm\ElggTheme\Menus\SettingsManu::class => [], | ||
], | ||
], | ||
], | ||
|
||
'view_extensions' => [ | ||
'admin.css' => [ | ||
'elgg_theme/elgg_theme_admin.css' => [], | ||
], | ||
'elgg.css' => [ | ||
'elgg_theme/elgg_theme.css' => [], | ||
], | ||
'river/sidebar' => [ | ||
'elgg_theme/sidebar' => [], | ||
], | ||
], | ||
|
||
'view_options' => [ | ||
'graphics/cover.jpg' => ['simplecache' => true], | ||
], | ||
|
||
'views' => [ | ||
'default' => [ | ||
'elgg_theme/' => elgg_get_data_path() . 'elgg_theme/', | ||
], | ||
], | ||
|
||
'settings' => [ | ||
'topbar_logo_text' => true, | ||
'landing_action' => true, | ||
'display_members' => true, | ||
'display_groups' => false, | ||
'activity_sidebar' => false, | ||
'sidebar_profile_icon' => true, | ||
'sidebar_friends' => true, | ||
], | ||
]; | ||
|
Oops, something went wrong.