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
a43f19ad
Commit
a43f19ad
authored
Mar 07, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor plugin classes for PHP 5
parent
b2da9e7e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
80 additions
and
103 deletions
+80
-103
qa-widget-ask-box.php
qa-include/qa-widget-ask-box.php
+0
-1
qa-basic-adsense.php
qa-plugin/basic-adsense/qa-basic-adsense.php
+4
-4
qa-event-logger.php
qa-plugin/event-logger/qa-event-logger.php
+4
-4
qa-example-page.php
qa-plugin/example-page/qa-example-page.php
+7
-10
qa-facebook-layer.php
qa-plugin/facebook-login/qa-facebook-layer.php
+3
-3
qa-facebook-login-page.php
qa-plugin/facebook-login/qa-facebook-login-page.php
+5
-5
qa-facebook-login.php
qa-plugin/facebook-login/qa-facebook-login.php
+5
-5
qa-mouseover-admin-form.php
qa-plugin/mouseover-layer/qa-mouseover-admin-form.php
+2
-2
qa-mouseover-layer.php
qa-plugin/mouseover-layer/qa-mouseover-layer.php
+1
-1
qa-opensearch-layer.php
qa-plugin/opensearch-support/qa-opensearch-layer.php
+1
-1
qa-opensearch-page.php
qa-plugin/opensearch-support/qa-opensearch-page.php
+2
-2
qa-recaptcha-captcha.php
qa-plugin/recaptcha-captcha/qa-recaptcha-captcha.php
+7
-7
qa-tag-cloud.php
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
+12
-31
qa-xml-sitemap.php
qa-plugin/xml-sitemap/qa-xml-sitemap.php
+9
-9
qa-theme.php
qa-theme/Candy/qa-theme.php
+6
-6
qa-theme.php
qa-theme/Snow/qa-theme.php
+12
-12
No files found.
qa-include/qa-widget-ask-box.php
View file @
a43f19ad
...
...
@@ -32,7 +32,6 @@
'activity'
,
'categories'
,
'custom'
,
'feedback'
,
'qa'
,
'questions'
,
'hot'
,
'search'
,
'tag'
,
'tags'
,
'unanswered'
);
return
in_array
(
$template
,
$allowed
);
}
...
...
qa-plugin/basic-adsense/qa-basic-adsense.php
View file @
a43f19ad
...
...
@@ -26,19 +26,19 @@
class
qa_basic_adsense
{
function
allow_template
(
$template
)
public
function
allow_template
(
$template
)
{
return
(
$template
!=
'admin'
);
}
function
allow_region
(
$region
)
public
function
allow_region
(
$region
)
{
return
in_array
(
$region
,
array
(
'main'
,
'side'
,
'full'
));
}
function
admin_form
(
&
$qa_content
)
public
function
admin_form
(
&
$qa_content
)
{
$saved
=
false
;
...
...
@@ -70,7 +70,7 @@
}
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
public
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
{
$divstyle
=
''
;
...
...
qa-plugin/event-logger/qa-event-logger.php
View file @
a43f19ad
...
...
@@ -26,7 +26,7 @@
class
qa_event_logger
{
function
init_queries
(
$tableslc
)
public
function
init_queries
(
$tableslc
)
{
if
(
qa_opt
(
'event_logger_to_database'
))
{
$tablename
=
qa_db_add_table_prefix
(
'eventlog'
);
...
...
@@ -53,7 +53,7 @@
}
function
admin_form
(
&
$qa_content
)
public
function
admin_form
(
&
$qa_content
)
{
// Process form input
...
...
@@ -138,7 +138,7 @@
}
function
value_to_text
(
$value
)
public
function
value_to_text
(
$value
)
{
if
(
is_array
(
$value
))
$text
=
'array('
.
count
(
$value
)
.
')'
;
...
...
@@ -151,7 +151,7 @@
}
function
process_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
$params
)
public
function
process_event
(
$event
,
$userid
,
$handle
,
$cookieid
,
$params
)
{
if
(
qa_opt
(
'event_logger_to_database'
))
{
$paramstring
=
''
;
...
...
qa-plugin/example-page/qa-example-page.php
View file @
a43f19ad
...
...
@@ -26,18 +26,18 @@
class
qa_example_page
{
var
$directory
;
var
$urltoroot
;
private
$directory
;
private
$urltoroot
;
function
load_module
(
$directory
,
$urltoroot
)
public
function
load_module
(
$directory
,
$urltoroot
)
{
$this
->
directory
=
$directory
;
$this
->
urltoroot
=
$urltoroot
;
}
function
suggest_requests
()
// for display in admin interface
public
function
suggest_requests
()
// for display in admin interface
{
return
array
(
array
(
...
...
@@ -49,16 +49,13 @@
}
function
match_request
(
$request
)
public
function
match_request
(
$request
)
{
if
(
$request
==
'example-plugin-page'
)
return
true
;
return
false
;
return
$request
==
'example-plugin-page'
;
}
function
process_request
(
$request
)
public
function
process_request
(
$request
)
{
$qa_content
=
qa_content_prepare
();
...
...
qa-plugin/facebook-login/qa-facebook-layer.php
View file @
a43f19ad
...
...
@@ -26,15 +26,15 @@
class
qa_html_theme_layer
extends
qa_html_theme_base
{
function
head_css
()
public
function
head_css
()
{
qa_html_theme_base
::
head_css
();
if
(
strlen
(
qa_opt
(
'facebook_app_id'
))
&&
strlen
(
qa_opt
(
'facebook_app_secret'
)))
$this
->
output
(
'<style>
<!--
'
,
'<style>'
,
'.fb-login-button.fb_iframe_widget.fb_hide_iframes span {display:none;}'
,
'
-->
</style>'
'</style>'
);
}
...
...
qa-plugin/facebook-login/qa-facebook-login-page.php
View file @
a43f19ad
...
...
@@ -26,21 +26,21 @@
class
qa_facebook_login_page
{
var
$directory
;
var
$urltoroot
;
private
$directory
;
private
$urltoroot
;
function
load_module
(
$directory
,
$urltoroot
)
public
function
load_module
(
$directory
,
$urltoroot
)
{
$this
->
directory
=
$directory
;
$this
->
urltoroot
=
$urltoroot
;
}
function
match_request
(
$request
)
public
function
match_request
(
$request
)
{
return
(
$request
==
'facebook-login'
);
}
function
process_request
(
$request
)
public
function
process_request
(
$request
)
{
if
(
$request
==
'facebook-login'
)
{
$app_id
=
qa_opt
(
'facebook_app_id'
);
...
...
qa-plugin/facebook-login/qa-facebook-login.php
View file @
a43f19ad
...
...
@@ -26,13 +26,13 @@
class
qa_facebook_login
{
function
match_source
(
$source
)
public
function
match_source
(
$source
)
{
return
$source
==
'facebook'
;
}
function
login_html
(
$tourl
,
$context
)
public
function
login_html
(
$tourl
,
$context
)
{
$app_id
=
qa_opt
(
'facebook_app_id'
);
...
...
@@ -43,7 +43,7 @@
}
function
logout_html
(
$tourl
)
public
function
logout_html
(
$tourl
)
{
$app_id
=
qa_opt
(
'facebook_app_id'
);
...
...
@@ -54,7 +54,7 @@
}
function
facebook_html
(
$tourl
,
$logout
,
$context
)
public
function
facebook_html
(
$tourl
,
$logout
,
$context
)
{
if
((
$context
==
'login'
)
||
(
$context
==
'register'
))
$size
=
'large'
;
...
...
@@ -92,7 +92,7 @@
}
function
admin_form
()
public
function
admin_form
()
{
$saved
=
false
;
...
...
qa-plugin/mouseover-layer/qa-mouseover-admin-form.php
View file @
a43f19ad
...
...
@@ -26,14 +26,14 @@
class
qa_mouseover_admin_form
{
function
option_default
(
$option
)
public
function
option_default
(
$option
)
{
if
(
$option
==
'mouseover_content_max_len'
)
return
480
;
}
function
admin_form
(
&
$qa_content
)
public
function
admin_form
(
&
$qa_content
)
{
$saved
=
false
;
...
...
qa-plugin/mouseover-layer/qa-mouseover-layer.php
View file @
a43f19ad
...
...
@@ -26,7 +26,7 @@
class
qa_html_theme_layer
extends
qa_html_theme_base
{
function
q_list
(
$q_list
)
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
...
...
qa-plugin/opensearch-support/qa-opensearch-layer.php
View file @
a43f19ad
...
...
@@ -26,7 +26,7 @@
class
qa_html_theme_layer
extends
qa_html_theme_base
{
function
head_links
()
public
function
head_links
()
{
qa_html_theme_base
::
head_links
();
...
...
qa-plugin/opensearch-support/qa-opensearch-page.php
View file @
a43f19ad
...
...
@@ -26,12 +26,12 @@
class
qa_opensearch_xml
{
function
match_request
(
$request
)
public
function
match_request
(
$request
)
{
return
(
$request
==
'opensearch.xml'
);
}
function
process_request
(
$request
)
public
function
process_request
(
$request
)
{
@
ini_set
(
'display_errors'
,
0
);
// we don't want to show PHP errors inside XML
...
...
qa-plugin/recaptcha-captcha/qa-recaptcha-captcha.php
View file @
a43f19ad
...
...
@@ -32,15 +32,15 @@
class
qa_recaptcha_captcha
{
var
$directory
;
private
$directory
;
function
load_module
(
$directory
,
$urltoroot
)
public
function
load_module
(
$directory
,
$urltoroot
)
{
$this
->
directory
=
$directory
;
}
function
admin_form
()
public
function
admin_form
()
{
$saved
=
false
;
...
...
@@ -81,7 +81,7 @@
}
function
recaptcha_error_html
()
public
function
recaptcha_error_html
()
{
if
(
!
function_exists
(
'fsockopen'
))
return
'To use reCAPTCHA, the fsockopen() PHP function must be enabled on your server. Please check with your system administrator.'
;
...
...
@@ -98,13 +98,13 @@
}
function
allow_captcha
()
public
function
allow_captcha
()
{
return
function_exists
(
'fsockopen'
)
&&
strlen
(
trim
(
qa_opt
(
'recaptcha_public_key'
)))
&&
strlen
(
trim
(
qa_opt
(
'recaptcha_private_key'
)));
}
function
form_html
(
&
$qa_content
,
$error
)
public
function
form_html
(
&
$qa_content
,
$error
)
{
require_once
$this
->
directory
.
'recaptchalib.php'
;
...
...
@@ -123,7 +123,7 @@
}
function
validate_post
(
&
$error
)
public
function
validate_post
(
&
$error
)
{
if
(
(
!
empty
(
$_POST
[
'recaptcha_challenge_field'
]))
&&
(
!
empty
(
$_POST
[
'recaptcha_response_field'
]))
)
{
require_once
$this
->
directory
.
'recaptchalib.php'
;
...
...
qa-plugin/tag-cloud-widget/qa-tag-cloud.php
View file @
a43f19ad
...
...
@@ -26,18 +26,18 @@
class
qa_tag_cloud
{
function
option_default
(
$option
)
public
function
option_default
(
$option
)
{
if
(
$option
==
'tag_cloud_count_tags'
)
return
100
;
else
if
(
$option
==
'tag_cloud_font_size'
)
if
(
$option
==
'tag_cloud_font_size'
)
return
24
;
else
if
(
$option
==
'tag_cloud_size_popular'
)
if
(
$option
==
'tag_cloud_size_popular'
)
return
true
;
}
function
admin_form
()
public
function
admin_form
()
{
$saved
=
false
;
...
...
@@ -86,42 +86,23 @@
}
function
allow_template
(
$template
)
public
function
allow_template
(
$template
)
{
$allow
=
false
;
switch
(
$template
)
{
case
'activity'
:
case
'qa'
:
case
'questions'
:
case
'hot'
:
case
'ask'
:
case
'categories'
:
case
'question'
:
case
'tag'
:
case
'tags'
:
case
'unanswered'
:
case
'user'
:
case
'users'
:
case
'search'
:
case
'admin'
:
case
'custom'
:
$allow
=
true
;
break
;
}
return
$allow
;
$allowed
=
array
(
'activity'
,
'qa'
,
'questions'
,
'hot'
,
'ask'
,
'categories'
,
'question'
,
'tag'
,
'tags'
,
'unanswered'
,
'user'
,
'users'
,
'search'
,
'admin'
,
'custom'
,
);
return
in_array
(
$template
,
$allowed
);
}
function
allow_region
(
$region
)
public
function
allow_region
(
$region
)
{
return
(
$region
==
'side'
);
}
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
public
function
output_widget
(
$region
,
$place
,
$themeobject
,
$template
,
$request
,
$qa_content
)
{
require_once
QA_INCLUDE_DIR
.
'qa-db-selects.php'
;
...
...
qa-plugin/xml-sitemap/qa-xml-sitemap.php
View file @
a43f19ad
...
...
@@ -26,17 +26,17 @@
class
qa_xml_sitemap
{
var
$directory
;
var
$urltoroot
;
private
$directory
;
private
$urltoroot
;
function
load_module
(
$directory
,
$urltoroot
)
public
function
load_module
(
$directory
,
$urltoroot
)
{
$this
->
directory
=
$directory
;
$this
->
urltoroot
=
$urltoroot
;
}
function
option_default
(
$option
)
public
function
option_default
(
$option
)
{
switch
(
$option
)
{
case
'xml_sitemap_show_questions'
:
...
...
@@ -50,7 +50,7 @@
}
function
admin_form
()
public
function
admin_form
()
{
require_once
QA_INCLUDE_DIR
.
'qa-util-sort.php'
;
...
...
@@ -129,7 +129,7 @@
}
function
suggest_requests
()
public
function
suggest_requests
()
{
return
array
(
array
(
...
...
@@ -141,13 +141,13 @@
}
function
match_request
(
$request
)
public
function
match_request
(
$request
)
{
return
(
$request
==
'sitemap.xml'
);
}
function
process_request
(
$request
)
public
function
process_request
(
$request
)
{
@
ini_set
(
'display_errors'
,
0
);
// we don't want to show PHP errors inside XML
...
...
@@ -285,7 +285,7 @@
}
function
sitemap_output
(
$request
,
$priority
)
private
function
sitemap_output
(
$request
,
$priority
)
{
echo
"
\t
<url>
\n
"
.
"
\t\t
<loc>"
.
qa_xml
(
qa_path
(
$request
,
null
,
qa_opt
(
'site_url'
)))
.
"</loc>
\n
"
.
...
...
qa-theme/Candy/qa-theme.php
View file @
a43f19ad
...
...
@@ -24,14 +24,14 @@
More about this license: http://www.question2answer.org/license.php
*/
class
qa_html_theme
extends
qa_html_theme_base
class
qa_html_theme
extends
qa_html_theme_base
{
public
function
nav_user_search
()
// reverse the usual order
{
function
nav_user_search
()
// reverse the usual order
{
$this
->
search
();
$this
->
nav
(
'user'
);
}
$this
->
search
();
$this
->
nav
(
'user'
);
}
}
/*
...
...
qa-theme/Snow/qa-theme.php
View file @
a43f19ad
...
...
@@ -3,7 +3,7 @@
class
qa_html_theme
extends
qa_html_theme_base
{
// outputs login form if user not logged in
function
nav_user_search
()
public
function
nav_user_search
()
{
if
(
!
qa_is_logged_in
())
{
$login
=@
$this
->
content
[
'navigation'
][
'user'
][
'login'
];
...
...
@@ -29,7 +29,7 @@ class qa_html_theme extends qa_html_theme_base
qa_html_theme_base
::
nav_user_search
();
}
function
logged_in
()
public
function
logged_in
()
{
if
(
qa_is_logged_in
())
// output user avatar to login bar
$this
->
output
(
...
...
@@ -60,7 +60,7 @@ class qa_html_theme extends qa_html_theme_base
}
// adds login bar, user navigation and search at top of page in place of custom header content
function
body_header
()
public
function
body_header
()
{
$this
->
output
(
'<div id="qa-login-bar"><div id="qa-login-group">'
);
$this
->
nav_user_search
();
...
...
@@ -68,7 +68,7 @@ class qa_html_theme extends qa_html_theme_base
}
// allows modification of custom element shown inside header after logo
function
header_custom
()
public
function
header_custom
()
{
if
(
isset
(
$this
->
content
[
'body_header'
]))
{
$this
->
output
(
'<div class="header-banner">'
);
...
...
@@ -78,7 +78,7 @@ class qa_html_theme extends qa_html_theme_base
}
// removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
function
header
()
public
function
header
()
{
$this
->
output
(
'<div class="qa-header">'
);
...
...
@@ -95,21 +95,21 @@ class qa_html_theme extends qa_html_theme_base
}
// removes sidebar for user profile pages
function
sidepanel
()
public
function
sidepanel
()
{
if
(
$this
->
template
!=
'user'
)
qa_html_theme_base
::
sidepanel
();
}
// prevent display of regular footer content (see body_suffix()) and replace with closing new <div>s
function
footer
()
public
function
footer
()
{
$this
->
output
(
'</div> <!-- END main-wrapper -->'
);
$this
->
output
(
'</div> <!-- END main-shadow -->'
);
}
// add RSS feed icon after the page title
function
title
()
public
function
title
()
{
qa_html_theme_base
::
title
();
...
...
@@ -120,7 +120,7 @@ class qa_html_theme extends qa_html_theme_base
}
// add view count to question list
function
q_item_stats
(
$q_item
)
public
function
q_item_stats
(
$q_item
)
{
$this
->
output
(
'<div class="qa-q-item-stats">'
);
...
...
@@ -132,21 +132,21 @@ class qa_html_theme extends qa_html_theme_base
}
// prevent display of view count in the usual place
function
view_count
(
$q_item
)
public
function
view_count
(
$q_item
)
{
if
(
$this
->
template
==
'question'
)
qa_html_theme_base
::
view_count
(
$q_item
);
}
// to replace standard Q2A footer
function
body_suffix
()
public
function
body_suffix
()
{
$this
->
output
(
'<div class="qa-footer-bottom-group">'
);
qa_html_theme_base
::
footer
();
$this
->
output
(
'</div> <!-- END footer-bottom-group -->'
,
''
);
}
function
attribution
()
public
function
attribution
()
{
$this
->
output
(
'<div class="qa-attribution">'
,
...
...
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