[ABD] TimeAgo timestamps

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
Locked
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

[ABD] TimeAgo timestamps

Post by MuhClaren »

Image Image

Extension Name: TimeAgo
Extension Version: 1.4.2b
Requirements: PHP 5.3, phpBB 3.1.x
Author: MuhClaren

Extension Description: This extension changes the phpBB native date-time to a Time Ago format. Example: (Before) Saturday, January 1, 1984 (After) 8 Months, 2 Weeks, 3 Days Ago.

Extension Download: v1.4.2b (.zip), v1.4.2b (.tar.gz), or get the latest WIP: bleeding
Project repository: Visit us on Github

Language Support: ar, cs, de, en, en_us, es, it, nl, tr. Language contributions are appreciated.

Translators:
Arabic (AR): Alhitary
Czech (CS): R3gi
German (DE): Miri4Ever
Español (ES): Raul [ThE KuKa]
Dutch (NL): Svennson
Italian (IT): Sakkiotto
Turkish (TR): Cycling

Highlights:
  • Compatible with all styles that use the native phpBB timestamp template tags
  • 100% PHP, no Javascript or template editing necessary
  • Three (3) adjustable levels of detail
  • Support for times from Seconds through Decades
  • Configurable display options for Index.php, viewforum.php, viewtopic.php
  • "Extended" detail option appends phpBB native timestamp to the end of the TimeAgo output.
  • Automatically adapts for proper word order for non-English languages
  • Definable de-activation timer to display native phpBB date-time on posts older than set number of days
Quickstart:
Install: Extract the archive to the following folders in your extensions directory tree: /mop/timeago (final path looks like this: /ext/mop/timeago).
Enable: Open your ACP --> Customise --> locate TimeAgo extension in the list, click enable. Configuration options are available from the "Extensions" tab, TimeAgo General Settings.

History:
**** v1.4.2 Change Log ****
  • [QA] Optimize codebase via scrutinizer
**** v1.4.1 Change Log ****
  • [FIX] Divide by zero in timeago function caused by code formatter misplacing a curly brace
  • [QA] Optimize acp timeago_module to reduce paths and complexity
**** v1.4.0 Change Log ****
  • [UPGRADE] Support added for Paybas 'Recent Topics' extension
  • [UPGRADE] Add support for Turkish language
  • [FIX] Updated incomplete translation
  • [FIX] Minor UI issue (placement of checkbox element)
  • [QA] Clean, simplify, optimize core methods
**** v1.3.1 Change Log ****
  • [FEATURE] Timer setting in control panel to define 1-999 days. When the post has aged that many days, TimeAgo output reverts to native phpBB date-time output.
  • [FIX] Support for language word order (i.e. placement of 'ago')
  • [FIX] Index.php - check for posts to determine output
  • [QA] Add support for travis-ci and EPV (Extension Pre Validator) testing
Other:
NOTES: Any translations which require non-English word order of the TimeAgo output string, the translator should notify me of such requirements when submitting the translation.

OPTIONAL: Native phpBB date-time output can be customized: ACP --> General --> Board Settings --> Date Format: custom. Edit the string to your required specifications. You'll need to push this custom setting to the users, too, since it's not set to custom by default at installation. Please note that this is optional, and not required for TimeAgo to function.
Last edited by MuhClaren on Mon Feb 27, 2017 12:56 am, edited 49 times in total.
User avatar
optimusvault
Registered User
Posts: 108
Joined: Tue Jul 28, 2015 2:51 am
Name: Aaron

Re: [DEV] TimeAgo timestamps

Post by optimusvault »

Nice! Thank you. Great extension.
Cheers,
Aaron
User avatar
Dragosvr92
Registered User
Posts: 1470
Joined: Sat Sep 12, 2009 7:27 am
Location: Romania
Name: Dragos Valentin Rădulescu
Contact:

Re: [DEV] TimeAgo timestamps

Post by Dragosvr92 »

Request topic: viewtopic.php?f=496&t=2325786
Well done MuhClaren, thanks :)
Formerly known as TheKiller
3.0| Avatar on Memberlist 1.0.3
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

My code formatter mucked up a couple of lines in the timeago function, causing a divide by zero condition. :oops:

Fixed now, version 1.1.9 pushed to github.
svennson
Registered User
Posts: 60
Joined: Wed Jun 01, 2005 4:54 pm
Location: Belguim
Contact:

Re: [DEV] TimeAgo timestamps

Post by svennson »

I think I found 2 buggies!
- language is not adapted to non-English (duh) I tranlated (see below) however its still wrong, maybe this is me, but in Dutch for example Months are translated as Maanden. (so not just adding a S)
- In the ACP, ext/mop/timeago/adm/style/images/tiny_orange_checkbox.png will not load when the forum is not a root domain ? (maybe its something else tho)
example.com works;
example.com/forum/ doesn't seem to work;

Dutch tranlation :

Code: Select all

<?php
/**
 * TimeAgo - LANGUAGE FILE
 *
 * This file contains the (Dutch) language definitions for
 * the labels and explanations text used in the admin control panel
 * TimeAgo Extension Settings module.
 *
 * PHP Version 5.4
 *
 * @category  PHP
 * @package   timeago
 * @author    MuhClaren
 * @copyright 2015 (c) MOP
 * @license   GNU General Public License v2
 * @translation SvennD
 */

/**
 * DO NOT CHANGE
 */
if (defined('IN_PHPBB') === FALSE)
{
	exit;
}

if (empty($lang) || is_array($lang) === FALSE)
{
	$lang = [];
}

$lang = array_merge(
	$lang,
	[
		// common lang variables
		'CHARS'                       => 'karakters',
		'TA_SECOND'                   => 'Seconde',
		'TA_MINUTE'                   => 'Minuut',
		'TA_HOUR'                     => 'Uur',
		'TA_DAY'                      => 'Dag',
		'TA_WEEK'                     => 'Week',
		'TA_MONTH'                    => 'Maand',
		'TA_YEAR'                     => 'Jaar',
		'TA_DECADE'                   => 'Decennium',
		'TA_OFF'                      => 'Uit',
		'TA_SHORT'                    => 'Kort (1 Jaar Geleden)',
		'TA_MEDIUM'                   => 'Gemiddeld (1 Jaren 2 Maanden Geleden)',
		// general settings
		'TA_GENERAL_SETTINGS'         => 'Algemene Instellingen',
		'TA_GENERAL_SETTINGS_EXPLAIN' => 'Configurerbare TimeAgo instellingen',
		'TA_DISPLAY_SETTINGS'         => 'TimeAgo Formaat Opties',
		'TA_CAT'                      => 'index.php',
		'TA_CAT_EXPLAIN'              => 'Activeerd TimeAgo op de category forum lijst voor "Laatste Post"',
		'TA_VIEWFORUM'                => 'viewforum.php',
		'TA_VIEWFORUM_EXPLAIN'        => 'Activeerd TimeAgo op de lijst van topics in forum view',
		'TA_VIEWTOPIC'                => 'viewtopic.php',
		'TA_VIEWTOPIC_EXPLAIN'        => 'Activeerd TimeAgo in elke post',
		'TA_FULL'                     => 'Volledig (1 Jaar 2 Maanden 3 Dagen geleden)',
		'TA_EXTENDED'                 => 'Uitgebreid',
		'TA_EXTENDED_EXPLAIN'         => 'Voeg de standaard phpBB tijdnotatie toe aan het eind van TimeAgo.',
		'TA_EXTENDED_EXAMPLE'         => '(BV. 9 uren geleden (Sat Aug 08, 2015 11:57 am))',
		'TA_DETAIL'                   => 'Gedetaileerd niveau',
	]
);

Code: Select all

<?php
/**
 * TimeAgo - LANGUAGE FILE
 *
 * This file contains the (English - British) language definitions for
 * the labels used in the ACP extensions tab
 *
 * PHP Version 5.4
 *
 * @category  PHP
 * @package   timeago
 * @author    MuhClaren
 * @copyright 2015 (c) MOP
 * @license   GNU General Public License v2
 */

/**
 * DO NOT CHANGE
 */
if (defined('IN_PHPBB') === FALSE)
{
	exit;
}

if (empty($lang) || is_array($lang) === FALSE)
{
	$lang = [];
}

$lang = array_merge(
	$lang,
	[
		// module category and section titles
		'ACP_TIMEAGO_TITLE'            => 'TimeAgo',
		'ACP_TIMEAGO_GENERAL_SETTINGS' => 'Algemene Instellingen',
	]
);
Thx for this extension ! Thanks!
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

svennson wrote: ...language is not adapted to non-English (duh) I tranlated (see below)...
Thank you! I've added it to the package and pushed it to Github. I presumed that the language abbreviation should be nl, but if that's incorrect, please let me know.
svennson wrote: - In the ACP, ext/mop/timeago/adm/style/images/tiny_orange_checkbox.png will not load when the forum is not a root domain ? (maybe its something else tho)
example.com works;
example.com/forum/ doesn't seem to work;
I've added a path helper template variable to the scoped CSS which will dynamically adapt the URL to varying installation locations. You may need to disable TimeAgo, install the new version, purge your forum cache, and then enable TimeAgo, in order to see the changes.

TimeAgo v 1.1.10 is available for download.

Thanks for your feedback. ;)
svennson
Registered User
Posts: 60
Joined: Wed Jun 01, 2005 4:54 pm
Location: Belguim
Contact:

Re: [DEV] TimeAgo timestamps

Post by svennson »

Thx for the upgrade; I think however you misunderstood my "language" problem

In English its like this :
8 Months, 2 Weeks, 3 Days Ago.
In Dutch its like this :
8 Maanden, 2 Weken, 3 Dagen geleden.
Translated the mod shows :
8 Maands, 2 Weeks, 3 Dags geleden.
I peaked in your code, and I think the "problem" is here :
timeago_functions.php : line 88

Code: Select all

if ($no <> 1)
{
	$pds[$v] .= 's';
}
This should be "dynamic" looking for the plurals in the translation (?); Either way, thanks for updating the extension ! (Ill try, this evening)

// nl = dutch 8-)
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

svennson wrote:Thx for the upgrade; I think however you misunderstood my "language" problem

In English its like this :
8 Months, 2 Weeks, 3 Days Ago.
In Dutch its like this :
8 Maanden, 2 Weken, 3 Dagen geleden.
Translated the mod shows :
8 Maands, 2 Weeks, 3 Dags geleden.
I peaked in your code, and I think the "problem" is here :
timeago_functions.php : line 88

Code: Select all

if ($no <> 1)
{
	$pds[$v] .= 's';
}
This should be "dynamic" looking for the plurals in the translation (?); Either way, thanks for updating the extension ! (Ill try, this evening)

// nl = dutch 8-)
Indeed I misunderstood the issue, thanks for clarifying, I understand now. I'll give some thought on how I might wish to approach a solution. You're correct, it's simply a matter of adjusting the plurals conditionally.
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

Svennson, I've expanded the lang file to include definitions for plural characters, and adapted the function accordingly.

Please try v1.1.11 sometime, and tell me if that has solved the issue.

Thanks again.
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [DEV] TimeAgo timestamps

Post by david63 »

For plurals you should use the Plural Rules wherever possible.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

david63 wrote:For plurals you should use the Plural Rules wherever possible.
Ah, thank you for this. I'll bookmark and read up on it.
User avatar
R3gi
Registered User
Posts: 126
Joined: Mon May 05, 2014 4:33 pm
Location: Czech Republic
Contact:

Re: [DEV] TimeAgo timestamps

Post by R3gi »

Hello, I've started working on Czech localization, but unfortunately I can't continue. In Czech we have different plurals depending on the count, position in the sentence and context. Could you please update it?
Example:
The user has joined our forum...
1 year ago - před rokem / před 1 rokem
2-4 years ago - před 2-4 roky
5 and more years ago - před 5 a více roky

So you should add three strings per every unit: for singular, paucal and for plural.
User avatar
DevMakoto
Registered User
Posts: 66
Joined: Tue Jun 23, 2015 3:38 pm
Name: Carlos Mayorga
Contact:

Re: [DEV] TimeAgo timestamps

Post by DevMakoto »

"ago" translate?
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [DEV] TimeAgo timestamps

Post by 3Di »

DevMakoto wrote:"ago" translate?
at a certain time in the past
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
MuhClaren
Registered User
Posts: 126
Joined: Sat Feb 21, 2015 5:23 am

Re: [DEV] TimeAgo timestamps

Post by MuhClaren »

R3gi wrote:Hello, I've started working on Czech localization, but unfortunately I can't continue. In Czech we have different plurals depending on the count, position in the sentence and context. Could you please update it?
Example:
The user has joined our forum...
1 year ago - před rokem / před 1 rokem
2-4 years ago - před 2-4 roky
5 and more years ago - před 5 a více roky

So you should add three strings per every unit: for singular, paucal and for plural.
I'm planning to expand the language framework to correctly account for these cases, shouldn't be more than a day or two and I'll be able to re-visit the extension coding to do it. I'll post a revision announcement here as soon as it's ready. Thank you for providing the Czech translation!
Locked

Return to “Abandoned Extensions”