Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
3ecffa5e
Commit
3ecffa5e
authored
Mar 11, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor qa-tag-cloud.php
parent
f7b60026
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
qa-tag-cloud.php
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
+23
-17
No files found.
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
View file @
3ecffa5e
...
...
@@ -24,14 +24,16 @@ class qa_tag_cloud
{
public
function
option_default
(
$option
)
{
if
(
$option
===
'tag_cloud_count_tags'
)
return
100
;
if
(
$option
===
'tag_cloud_font_size'
)
return
24
;
if
(
$option
===
'tag_cloud_minimal_font_size'
)
return
10
;
if
(
$option
===
'tag_cloud_size_popular'
)
return
true
;
switch
(
$option
)
{
case
'tag_cloud_count_tags'
:
return
100
;
case
'tag_cloud_font_size'
:
return
24
;
case
'tag_cloud_minimal_font_size'
:
return
10
;
case
'tag_cloud_size_popular'
:
return
true
;
}
}
...
...
@@ -131,16 +133,20 @@ class qa_tag_cloud
foreach
(
$populartagslog
as
$tag
=>
$count
)
{
$matches
=
qa_block_words_match_all
(
$tag
,
$blockwordspreg
);
if
(
empty
(
$matches
))
{
if
(
$scale
)
{
$size
=
number_format
(
$maxsize
*
$count
/
$maxcount
,
1
);
if
(
$size
<
$minsize
)
$size
=
$minsize
;
}
else
$size
=
$maxsize
;
$themeobject
->
output
(
sprintf
(
'<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>'
,
qa_path_html
(
'tag/'
.
$tag
),
$size
,
qa_html
(
$tag
)));
if
(
!
empty
(
$matches
))
{
continue
;
}
if
(
$scale
)
{
$size
=
number_format
(
$maxsize
*
$count
/
$maxcount
,
1
);
if
(
$size
<
$minsize
)
{
$size
=
$minsize
;
}
}
else
{
$size
=
$maxsize
;
}
$themeobject
->
output
(
sprintf
(
'<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>'
,
qa_path_html
(
'tag/'
.
$tag
),
$size
,
qa_html
(
$tag
)));
}
$themeobject
->
output
(
'</div>'
);
...
...
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