Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IMC-GER committed Dec 15, 2022
1 parent 3851716 commit 73ef0e1
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 69 deletions.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ With "Hide for guest" selected areas are hidden for guests and bots.
- phpBB 3.2.0 or higher

## Installation
Copy the extension to `phpBB3/ext/imcger/hideforguest`
Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.
- Copy the extension to `phpBB3/ext/imcger/hideforguest`.
- Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.

## Update
- Navigate in the ACP to `Customise -> Manage extensions`.
- Click the `Disable` link for Hide for Guest.
- Delete the `hideforguest` folder from `phpBB3/ext/imcger/`.
- Copy the extension to `phpBB3/ext/imcger/hideforguest`.
- Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.

## Settings
From the ACP, you can customize "Hide for Guest".
Expand All @@ -20,19 +27,27 @@ Go to "ACP" > "Extensions" > "Hide for Guest settings" and customize "Hide for G

## Changelog

### v1.1.0 (15-12-2022)
- Fixed don't request disabled POST value
- Changed to TWIG syntax
- Changed PHP max to 8.2
- Added Controller for ACP template
- Added version check
- Added check system requirement

### v1.0.4 (18-03-2022)
- Cleanup code

### v1.0.3 (05-02-2022)
- Bug in JS, `regexp` don't work in iPhone Safari
- Fixed bug in JS, `regexp` don't work with Safari

### v1.0.2 (06-01-2022)
- Bug in JS
- Fixed bug in JS

### v1.0.1 (03-01-2022)
- minor code change
- Add no break spaces in statistic line
- Add dependencies of radio buttons in ACP settings
- Minor code change
- Added no break spaces in statistic line
- Added dependencies of radio buttons in ACP settings

### v1.0.0 (01-01-2022)

Expand Down
29 changes: 22 additions & 7 deletions imcger/hideforguest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ With "Hide for guest" selected areas are hidden for guests and bots.
- phpBB 3.2.0 or higher

## Installation
Copy the extension to `phpBB3/ext/imcger/hideforguest`
Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.
- Copy the extension to `phpBB3/ext/imcger/hideforguest`.
- Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.

## Update
- Navigate in the ACP to `Customise -> Manage extensions`.
- Click the `Disable` link for Hide for Guest.
- Delete the `hideforguest` folder from `phpBB3/ext/imcger/`.
- Copy the extension to `phpBB3/ext/imcger/hideforguest`.
- Go to "ACP" > "Customise" > "Extensions Manager" and enable the "Hide for Guest" extension.

## Settings
From the ACP, you can customize "Hide for Guest".
Expand All @@ -20,19 +27,27 @@ Go to "ACP" > "Extensions" > "Hide for Guest settings" and customize "Hide for G

## Changelog

### v1.1.0 (15-12-2022)
- Fixed don't request disabled POST value
- Changed to TWIG syntax
- Changed PHP max to 8.2
- Added Controller for ACP template
- Added version check
- Added check system requirement

### v1.0.4 (18-03-2022)
- Cleanup code

### v1.0.3 (05-02-2022)
- Bug in JS, `regexp` don't work in iPhone Safari
- Fixed bug in JS, `regexp` don't work with Safari

### v1.0.2 (06-01-2022)
- Bug in JS
- Fixed bug in JS

### v1.0.1 (03-01-2022)
- minor code change
- Add no break spaces in statistic line
- Add dependencies of radio buttons in ACP settings
- Minor code change
- Added no break spaces in statistic line
- Added dependencies of radio buttons in ACP settings

### v1.0.0 (01-01-2022)

Expand Down
14 changes: 7 additions & 7 deletions imcger/hideforguest/acp/main_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ class main_info
{
public function module()
{
return array(
return [
'filename' => '\imcger\hideforguest\acp\main_module',
'title' => 'ACP_HIDEFORGUEST_TITLE',
'modes' => array(
'settings' => array(
'modes' => [
'settings' => [
'title' => 'ACP_HIDEFORGUEST_SETTINGS',
'auth' => 'ext_imcger/hideforguest && acl_a_board',
'cat' => array('ACP_HIDEFORGUEST_TITLE'),
),
),
);
'cat' => ['ACP_HIDEFORGUEST_TITLE'],
],
],
];
}
}
Empty file.
37 changes: 21 additions & 16 deletions imcger/hideforguest/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
"type": "phpbb-extension",
"description": "Hide for Guest Our newest member, Statistics or Who is online",
"homepage": "https://github.com/IMC-GER/phpBB-Hide-for-Guest",
"version": "1.0.4",
"time": "2022-03-18",
"version": "1.1.0",
"time": "2022-12-15",
"license": "GPL-2.0-only",
"authors": [
{
"name": "Thorsten Ahlers",
"homepage": "https://github.com/IMC-GER",
"role": "Developer"
}
],
"authors": [{
"name": "Thorsten Ahlers",
"homepage": "https://github.com/IMC-GER",
"role": "Developer"
}
],
"require": {
"php": ">=5.4.7"
},
"php": ">=5.4.7,<8.3.0"
},
"extra": {
"display-name": "Hide for Guest",
"soft-require": {
"phpbb/phpbb": ">=3.2.0,<4.0.0@dev"
}
}
"display-name": "Hide for Guest",
"soft-require": {
"phpbb/phpbb": ">=3.2.0,<4.0.0@dev"
},
"version-check": {
"host": "raw.githubusercontent.com",
"directory": "/IMC-GER/phpBB-Hide-for-Guest/main",
"filename": "hideforguest_version.json",
"ssl": true
}
}
}
4 changes: 2 additions & 2 deletions imcger/hideforguest/event/main_listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function __construct

public static function getSubscribedEvents()
{
return array(
return [
'core.page_header_after' => 'hide_for_guest_vars',
);
];
}

public function hide_for_guest_vars()
Expand Down
72 changes: 72 additions & 0 deletions imcger/hideforguest/ext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
*
* Hide for Guest
* An extension for the phpBB Forum Software package.
*
* @copyright (c) 2022, Thorsten Ahlers
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

namespace imcger\hideforguest;

/**
* Extension base
*/
class ext extends \phpbb\extension\base
{
/** @var Extension name */
protected $ext_name = 'hideforguest';

/** @var min phpBB version */
protected $phpbb_min_version = '3.2.0';

/** @var max phpBB version (>= query) */
protected $phpbb_max_version = '4.0.0';

/** @var min PHP version */
protected $php_min_version = '5.4.7';

/** @var nax PHP version (>= query) */
protected $php_max_version = '8.3.0';

/**
* Check the minimum and maximum requirements.
*
* @return bool|string|array A error message
*/
public function is_enableable()
{
/* If phpBB version 3.1 or less cancel */
if (phpbb_version_compare(PHPBB_VERSION, '3.2.0', '<'))
{
return false;
}

$language = $this->container->get('language');
$language->add_lang('info_acp_'. $this->ext_name, 'imcger/'. $this->ext_name);
$error_message = [];

/* phpBB version greater equal $phpbb_min_version and less then $phpbb_max_version */
if (phpbb_version_compare(PHPBB_VERSION, $this->phpbb_min_version, '<') || phpbb_version_compare(PHPBB_VERSION, $this->phpbb_max_version, '>='))
{
$error_message += ['error1' => $language->lang('IMCGER_REQUIRE_PHPBB', $this->phpbb_min_version, $this->phpbb_max_version, PHPBB_VERSION),];
}

/* php version equal or greater $php_min_version and less $php_max_version */
if (version_compare(PHP_VERSION, $this->php_min_version, '<') || version_compare(PHP_VERSION, $this->php_max_version, '>='))
{
$error_message += ['error2' => $language->lang('IMCGER_REQUIRE_PHP', $this->php_min_version, $this->php_max_version, PHP_VERSION),];
}

/* When phpBB v3.2 use trigger_error() for message output. For v3.1 return false. */
if (phpbb_version_compare(PHPBB_VERSION, '3.3.0', '<') && !empty($error_message))
{
$message = implode('<br>', $error_message);
trigger_error($message, E_USER_WARNING);
}

return empty($error_message) ? true : $error_message;
}
}
5 changes: 4 additions & 1 deletion imcger/hideforguest/language/de/info_acp_hideforguest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
$lang = array_merge($lang, array(
'ACP_HIDEFORGUEST_TITLE' => 'Hide for Guest',
'ACP_HIDEFORGUEST_SETTINGS' => 'Einstellungen',
'ACP_HIDEFORGUEST_SETTING_SAVED' => 'Hide for Guest Einstellungen erfolgreich gespeichert.'
'ACP_HIDEFORGUEST_SETTING_SAVED' => 'Hide for Guest Einstellungen erfolgreich gespeichert.',

'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser %1$s und kleiner %2$s. Deine Version ist %3$s.',
));
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
$lang = array_merge($lang, array(
'ACP_HIDEFORGUEST_TITLE' => 'Hide for Guest',
'ACP_HIDEFORGUEST_SETTINGS' => 'Einstellungen',
'ACP_HIDEFORGUEST_SETTING_SAVED' => 'Hide for Guest Einstellungen erfolgreich gespeichert.'
'ACP_HIDEFORGUEST_SETTING_SAVED' => 'Hide for Guest Einstellungen erfolgreich gespeichert.',

'IMCGER_REQUIRE_PHPBB' => 'Diese Erweiterung benötigt eine phpBB Version gleich oder grösser %1$s und kleiner %2$s. Ihre Version ist %3$s.',
'IMCGER_REQUIRE_PHP' => 'Diese Erweiterung benötigt eine php Version gleich oder grösser %1$s und kleiner %2$s. Ihre Version ist %3$s.',
));
5 changes: 4 additions & 1 deletion imcger/hideforguest/language/en/info_acp_hideforguest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
$lang = array_merge($lang, array(
'ACP_HIDEFORGUEST_TITLE' => 'Hide for Guest',
'ACP_HIDEFORGUEST_SETTINGS' => 'Settings',
'ACP_HIDEFORGUEST_SETTING_SAVED' => '"Hide for Guest" Settings saved successfully.'
'ACP_HIDEFORGUEST_SETTING_SAVED' => '"Hide for Guest" Settings saved successfully.',

'IMCGER_REQUIRE_PHPBB' => 'This extension requires a phpBB version greater or equal than %1$s and less than %2$s. Your version is %3$s.',
'IMCGER_REQUIRE_PHP' => 'This extension requires a php version greater or equal than %1$s and less than %2$s. Your version is %3$s.',
));
39 changes: 20 additions & 19 deletions imcger/hideforguest/migrations/install_acp_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ public function effectively_installed()

public static function depends_on()
{
return array('\phpbb\db\migration\data\v31x\v314');
return ['\phpbb\db\migration\data\v32x\v324'];
}

public function update_data()
{
return array(
array('config.add', array('imcger_hideforguest_newest_user', 0)),
array('config.add', array('imcger_hideforguest_statistics', 0)),
array('config.add', array('imcger_hideforguest_online_list', 0)),
return [
['config.add', ['imcger_hideforguest_newest_user', 0]],
['config.add', ['imcger_hideforguest_statistics', 0]],
['config.add', ['imcger_hideforguest_online_list', 0]],

array('module.add', array(
'acp',
'ACP_CAT_DOT_MODS',
'ACP_HIDEFORGUEST_TITLE'
)),
array('module.add', array(
'acp',
'ACP_HIDEFORGUEST_TITLE',
array(
'module_basename' => '\imcger\hideforguest\acp\main_module',
'modes' => array('settings'),
),
)),
);
['module.add', [
'acp',
'ACP_CAT_DOT_MODS',
'ACP_HIDEFORGUEST_TITLE'
],
],
['module.add', [
'acp',
'ACP_HIDEFORGUEST_TITLE', [
'module_basename' => '\imcger\hideforguest\acp\main_module',
'modes' => ['settings'],
],
],
],
];
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{% if NEWEST_USER %}
<script>
var statElem = document.querySelectorAll(".statistics > p");

if(statElem.length) {
var hideText = ' • ???';
var hideText = '&nbsp;• ???';
var statText = statElem[0].innerHTML.trim();

/* Funktion arbeitet leider nicht unter Safari, iPhone */
/* statText = statText.replace(/(?<=[a-zA-Z>:])(\s)(?=([a-zA-Z<]))/g, '&nbsp;'); */


// RegEx Lookbehind don't work with Safari
// statText = statText.replace(/(?<![\•])(\s+)/g, '&nbsp;');
statText = statText.replace(/\s+/g, '&nbsp;');
statText = statText.replace(/(\&nbsp\;\•\&nbsp\;)/g, ' • ');
statText = statText.replace(/(\&nbsp\;\•\&nbsp\;)/g, '&nbsp;• ');

{% if S_NEWEST_USER %}
if(statText.includes(hideText)) {
statText = statText.replace(hideText, '');
Expand Down

0 comments on commit 73ef0e1

Please sign in to comment.