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
f9667892
Commit
f9667892
authored
Aug 27, 2014
by
Scott
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pr/51' into dev
parents
22095853
bbbbd6bb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
62 deletions
+73
-62
qa-mouseover-admin-form.php
qa-plugin/mouseover-layer/qa-mouseover-admin-form.php
+6
-7
qa-mouseover-layer.php
qa-plugin/mouseover-layer/qa-mouseover-layer.php
+21
-19
qa-tag-cloud.php
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
+43
-33
qa-styles.css
qa-theme/Candy/qa-styles.css
+2
-2
qa-styles.css
qa-theme/Classic/qa-styles.css
+1
-1
No files found.
qa-plugin/mouseover-layer/qa-mouseover-admin-form.php
View file @
f9667892
...
...
@@ -28,19 +28,18 @@
public
function
option_default
(
$option
)
{
if
(
$option
==
'mouseover_content_max_len'
)
if
(
$option
===
'mouseover_content_max_len'
)
return
480
;
}
public
function
admin_form
(
&
$qa_content
)
{
$saved
=
false
;
$saved
=
qa_clicked
(
'mouseover_save_button'
)
;
if
(
qa_clicked
(
'mouseover_save_button'
))
{
qa_opt
(
'mouseover_content_on'
,
(
int
)
qa_post_text
(
'mouseover_content_on_field'
));
qa_opt
(
'mouseover_content_max_len'
,
(
int
)
qa_post_text
(
'mouseover_content_max_len_field'
));
$saved
=
true
;
if
(
$saved
)
{
qa_opt
(
'mouseover_content_on'
,
(
int
)
qa_post_text
(
'mouseover_content_on_field'
));
qa_opt
(
'mouseover_content_max_len'
,
(
int
)
qa_post_text
(
'mouseover_content_max_len_field'
));
}
qa_set_display_rules
(
$qa_content
,
array
(
...
...
@@ -63,7 +62,7 @@
'label'
=>
'Maximum length of preview:'
,
'suffix'
=>
'characters'
,
'type'
=>
'number'
,
'value'
=>
(
int
)
qa_opt
(
'mouseover_content_max_len'
),
'value'
=>
(
int
)
qa_opt
(
'mouseover_content_max_len'
),
'tags'
=>
'name="mouseover_content_max_len_field"'
,
),
),
...
...
qa-plugin/mouseover-layer/qa-mouseover-layer.php
View file @
f9667892
...
...
@@ -28,36 +28,38 @@
public
function
q_list
(
$q_list
)
{
if
(
count
(
@
$q_list
[
'qs'
])
&&
qa_opt
(
'mouseover_content_on'
))
{
// first check it is not an empty list and the feature is turned on
if
(
!
empty
(
$q_list
[
'qs'
])
&&
qa_opt
(
'mouseover_content_on'
))
{
// first check it is not an empty list and the feature is turned on
//
Collect the question ids of all items in the question list (so we can do this in one DB query)
//
Collect the question ids of all items in the question list (so we can do this in one DB query)
$postids
=
array
();
foreach
(
$q_list
[
'qs'
]
as
$question
)
$postids
=
array
();
foreach
(
$q_list
[
'qs'
]
as
$question
)
{
if
(
isset
(
$question
[
'raw'
][
'postid'
]))
$postids
[]
=
$question
[
'raw'
][
'postid'
];
$postids
[]
=
$question
[
'raw'
][
'postid'
];
}
if
(
count
(
$postids
))
{
if
(
!
empty
(
$postids
))
{
// Retrieve the content for these questions from the database and put into an array
// Retrieve the content for these questions from the database and put into an array fetching
// the minimal amount of characters needed to determine the string should be shortened or not
$result
=
qa_db_query_sub
(
'SELECT postid, content, format FROM ^posts WHERE postid IN (#)'
,
$postids
);
$postinfo
=
qa_db_read_all_assoc
(
$result
,
'postid'
);
$maxlength
=
qa_opt
(
'mouseover_content_max_len'
);
$result
=
qa_db_query_sub
(
'SELECT postid, LEFT(content, #) content, format FROM ^posts WHERE postid IN (#)'
,
$maxlength
+
1
,
$postids
);
$postinfo
=
qa_db_read_all_assoc
(
$result
,
'postid'
);
//
Get the regular expression fragment to use for blocked words and the maximum length of content to show
//
Get the regular expression fragment to use for blocked words and the maximum length of content to show
$blockwordspreg
=
qa_get_block_words_preg
();
$maxlength
=
qa_opt
(
'mouseover_content_max_len'
);
$blockwordspreg
=
qa_get_block_words_preg
();
//
Now add the popup to the title for each question
//
Now add the popup to the title for each question
foreach
(
$q_list
[
'qs'
]
as
$index
=>
$question
)
{
$thispost
=@
$postinfo
[
$question
[
'raw'
][
'postid'
]];
if
(
isset
(
$thispost
))
{
$text
=
qa_viewer_text
(
$thispost
[
'content'
],
$thispost
[
'format'
],
array
(
'blockwordspreg'
=>
$blockwordspreg
)
);
$t
ext
=
qa_shorten_string_line
(
$text
,
$maxlength
)
;
$q_list
[
'qs'
][
$index
][
'title'
]
=
'<span title="'
.
qa_html
(
$text
)
.
'">'
.@
$question
[
'title'
]
.
'</span>'
;
if
(
isset
(
$postinfo
[
$question
[
'raw'
][
'postid'
]]))
{
$thispost
=
$postinfo
[
$question
[
'raw'
][
'postid'
]];
$text
=
qa_viewer_text
(
$thispost
[
'content'
],
$thispost
[
'format'
],
array
(
'blockwordspreg'
=>
$blockwordspreg
));
$text
=
qa_shorten_string_line
(
$text
,
$maxlength
);
$t
itle
=
isset
(
$question
[
'title'
])
?
$question
[
'title'
]
:
''
;
$q_list
[
'qs'
][
$index
][
'title'
]
=
sprintf
(
'<span title="%s">%s</span>'
,
qa_html
(
$text
),
$title
)
;
}
}
}
...
...
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
View file @
f9667892
...
...
@@ -28,24 +28,26 @@
public
function
option_default
(
$option
)
{
if
(
$option
==
'tag_cloud_count_tags'
)
if
(
$option
===
'tag_cloud_count_tags'
)
return
100
;
if
(
$option
==
'tag_cloud_font_size'
)
if
(
$option
===
'tag_cloud_font_size'
)
return
24
;
if
(
$option
==
'tag_cloud_size_popular'
)
if
(
$option
===
'tag_cloud_minimal_font_size'
)
return
8
;
if
(
$option
===
'tag_cloud_size_popular'
)
return
true
;
}
public
function
admin_form
()
{
$saved
=
false
;
$saved
=
qa_clicked
(
'tag_cloud_save_button'
)
;
if
(
qa_clicked
(
'tag_cloud_save_button'
)
)
{
qa_opt
(
'tag_cloud_count_tags'
,
(
int
)
qa_post_text
(
'tag_cloud_count_tags_field'
));
qa_opt
(
'tag_cloud_font_size'
,
(
int
)
qa_post_text
(
'tag_cloud_font_size_field'
));
qa_opt
(
'tag_cloud_
size_popular'
,
(
int
)
qa_post_text
(
'tag_cloud_size_popular
_field'
));
$saved
=
true
;
if
(
$saved
)
{
qa_opt
(
'tag_cloud_count_tags'
,
(
int
)
qa_post_text
(
'tag_cloud_count_tags_field'
));
qa_opt
(
'tag_cloud_font_size'
,
(
int
)
qa_post_text
(
'tag_cloud_font_size_field'
));
qa_opt
(
'tag_cloud_
minimal_font_size'
,
(
int
)
qa_post_text
(
'tag_cloud_minimal_font_size
_field'
));
qa_opt
(
'tag_cloud_size_popular'
,
(
int
)
qa_post_text
(
'tag_cloud_size_popular_field'
))
;
}
return
array
(
...
...
@@ -55,20 +57,28 @@
array
(
'label'
=>
'Maximum tags to show:'
,
'type'
=>
'number'
,
'value'
=>
(
int
)
qa_opt
(
'tag_cloud_count_tags'
),
'value'
=>
(
int
)
qa_opt
(
'tag_cloud_count_tags'
),
'suffix'
=>
'tags'
,
'tags'
=>
'name="tag_cloud_count_tags_field"'
,
),
array
(
'label'
=>
'
Starting
font size:'
,
'label'
=>
'
Biggest
font size:'
,
'suffix'
=>
'pixels'
,
'type'
=>
'number'
,
'value'
=>
(
int
)
qa_opt
(
'tag_cloud_font_size'
),
'value'
=>
(
int
)
qa_opt
(
'tag_cloud_font_size'
),
'tags'
=>
'name="tag_cloud_font_size_field"'
,
),
array
(
'label'
=>
'Smallest allowed font size:'
,
'suffix'
=>
'pixels'
,
'type'
=>
'number'
,
'value'
=>
(
int
)
qa_opt
(
'tag_cloud_minimal_font_size'
),
'tags'
=>
'name="tag_cloud_minimal_font_size_field"'
,
),
array
(
'label'
=>
'Font size represents tag popularity'
,
'type'
=>
'checkbox'
,
'value'
=>
qa_opt
(
'tag_cloud_size_popular'
),
...
...
@@ -98,39 +108,39 @@
public
function
allow_region
(
$region
)
{
return
(
$region
==
'side'
);
return
(
$region
===
'side'
);
}
public
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
{
require_once
QA_INCLUDE_DIR
.
'qa-db-selects.php'
;
require_once
QA_INCLUDE_DIR
.
'qa-db-selects.php'
;
$populartags
=
qa_db_single_select
(
qa_db_popular_tags_selectspec
(
0
,
(
int
)
qa_opt
(
'tag_cloud_count_tags'
)));
$populartags
=
qa_db_single_select
(
qa_db_popular_tags_selectspec
(
0
,
(
int
)
qa_opt
(
'tag_cloud_count_tags'
)));
reset
(
$populartags
);
$maxcount
=
current
(
$populartags
);
$maxcount
=
reset
(
$populartags
);
$themeobject
->
output
(
'<h2 style="margin-top:0; padding-top:0;">'
,
qa_lang_html
(
'main/popular_tags'
),
'</h2>'
);
$themeobject
->
output
(
sprintf
(
'<h2 style="margin-top: 0; padding-top: 0;">%s</h2>'
,
qa_lang_html
(
'main/popular_tags'
)));
$themeobject
->
output
(
'<div style="font-size:10px;">'
);
$themeobject
->
output
(
'<div style="font-size:
10px;">'
);
$maxsize
=
qa_opt
(
'tag_cloud_font_size'
);
$scale
=
qa_opt
(
'tag_cloud_size_popular'
);
$blockwordspreg
=
qa_get_block_words_preg
();
$maxsize
=
qa_opt
(
'tag_cloud_font_size'
);
$minsize
=
qa_opt
(
'tag_cloud_minimal_font_size'
);
$scale
=
qa_opt
(
'tag_cloud_size_popular'
);
$blockwordspreg
=
qa_get_block_words_preg
();
foreach
(
$populartags
as
$tag
=>
$count
)
{
if
(
count
(
qa_block_words_match_all
(
$tag
,
$blockwordspreg
)))
continue
;
// skip censored tags
$size
=
number_format
((
$scale
?
(
$maxsize
*
$count
/
$maxcount
)
:
$maxsize
),
1
);
if
((
$size
>=
5
)
||
!
$scale
)
$themeobject
->
output
(
'<a href="'
.
qa_path_html
(
'tag/'
.
$tag
)
.
'" style="font-size:'
.
$size
.
'px; vertical-align:baseline;">'
.
qa_html
(
$tag
)
.
'</a>'
);
$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
)));
}
}
$themeobject
->
output
(
'</div>'
);
...
...
qa-theme/Candy/qa-styles.css
View file @
f9667892
...
...
@@ -126,7 +126,7 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-nav-main-item
{
float
:
left
;
padding-left
:
10px
;}
.qa-nav-main-item-opp
{
float
:
right
;
padding-right
:
10px
;}
.qa-nav-main-link
{
background
:
#efeb9c
url(nav-main-bg.png)
repeat-x
left
top
;
color
:
#597700
;
display
:
block
;
padding
:
14px
10px
;}
.qa-nav-main-link
:hover
,
.qa-nav-main-selected
{
url(nav-main-sel-bg.png)
repeat-x
left
top;
border-left
:
1px
solid
#e9e697
;
border-right
:
1px
solid
#e9e697
;
color
:
#8d006a
;
padding
:
14px
9px
;
text-decoration
:
none
;}
.qa-nav-main-link
:hover
,
.qa-nav-main-selected
{
background
:
url(nav-main-sel-bg.png)
repeat-x
left
top
;
border-left
:
1px
solid
#e9e697
;
border-right
:
1px
solid
#e9e697
;
color
:
#8d006a
;
padding
:
14px
9px
;
text-decoration
:
none
;}
.qa-nav-main-hot
.qa-nav-main-link
{
color
:
#c33
;}
.qa-nav-sub
{
clear
:
both
;
background
:
url(nav-sub-bg.png)
repeat-x
left
top
;}
...
...
@@ -446,7 +446,7 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-nav-footer-link
{
color
:
#FFF
;
text-decoration
:
underline
!important
;}
.qa-nav-footer-link
:hover
{
color
:
#f5d495
;}
.qa-attribution
{
float
:
right
;}
.qa-attribution
a
{
color
:
#FFF
;
text-decoration
:
underline
;
!important;
}
.qa-attribution
a
{
color
:
#FFF
;
text-decoration
:
underline
!important
;}
.qa-attribution
a
:hover
{
color
:
#f5d495
;}
/* Classes passed to theme */
...
...
qa-theme/Classic/qa-styles.css
View file @
f9667892
...
...
@@ -415,7 +415,7 @@ h2 {font-size:16px; padding-top:12px; clear:both;}
.qa-nav-footer-link
{
color
:
#FFF
;
text-decoration
:
underline
!important
;}
.qa-nav-footer-link
:hover
{
color
:
#f5d495
;}
.qa-attribution
{
float
:
right
;}
.qa-attribution
a
{
color
:
#FFF
;
text-decoration
:
underline
;
!important;
}
.qa-attribution
a
{
color
:
#FFF
;
text-decoration
:
underline
!important
;}
.qa-attribution
a
:hover
{
color
:
#f5d495
;}
/* Classes in HTML passed to theme class */
...
...
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