Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Leed-market
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Adrien Dorsaz
Leed-market
Commits
b87735e4
Commit
b87735e4
authored
Apr 28, 2014
by
Qwerty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create readingtime.plugin.disabled.php
parent
6988b5c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
ReadingTime/readingtime.plugin.disabled.php
ReadingTime/readingtime.plugin.disabled.php
+26
-0
No files found.
ReadingTime/readingtime.plugin.disabled.php
0 → 100644
View file @
b87735e4
<?php
/*
@name Reading Time
@author Qwerty <qwerty@legtux.org>
@link http://etudiant-libre.fr.nf
@licence Tea Licence
@version 1.0.0
@description Estime le temps de lecture d'un article
*/
function
readingtime
(
&
$event
)
{
$readingtime
=
null
;
$word
=
str_word_count
(
strip_tags
(
$event
->
getContent
()));
$minutes_estimate
=
floor
(
$word
/
200
);
$seconds_estimate
=
floor
(
$word
/
(
200
/
60
));
$hours
=
intval
(
$seconds_estimate
/
3600
);
$minutes
=
intval
((
$seconds_estimate
%
3600
)
/
60
);
$secondes
=
intval
(((
$seconds_estimate
%
3600
)
%
60
));
if
(
$hours
>=
1
)
{
$readingtime
.
=
$hours
.
'h '
;}
if
(
$minutes
>=
1
)
{
$readingtime
.
=
$minutes
.
'min '
;}
if
(
$minutes
<
1
&&
$hours
==
0
)
{
$readingtime
.
=
$secondes
.
's '
;}
echo
_t
(
'READING_TIME'
)
.
' '
.
$readingtime
;
}
Plugin
::
addHook
(
"event_pre_top_options"
,
"readingtime"
);
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment