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
4f47fc42
Commit
4f47fc42
authored
Feb 15, 2014
by
Scott Vivian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Snow theme: minor cleanup of theme PHP file
parent
92172a43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
130 deletions
+139
-130
qa-theme.php
qa-theme/Snow/qa-theme.php
+139
-130
No files found.
qa-theme/Snow/qa-theme.php
View file @
4f47fc42
<?php
class
qa_html_theme
extends
qa_html_theme_base
class
qa_html_theme
extends
qa_html_theme_base
{
// change style of WYSIWYG editor to match theme better
function
head_script
()
{
qa_html_theme_base
::
head_script
();
$this
->
output
(
'<script type="text/javascript">'
,
"if (typeof qa_wysiwyg_editor_config == 'object')"
,
"
\t
qa_wysiwyg_editor_config.skin='kama';"
,
'</script>'
);
}
function
head_script
()
// change style of WYSIWYG editor to match theme better
{
qa_html_theme_base
::
head_script
();
// outputs login form if user not logged in
function
nav_user_search
()
{
if
(
!
qa_is_logged_in
())
{
$login
=@
$this
->
content
[
'navigation'
][
'user'
][
'login'
];
$this
->
output
(
'<script type="text/javascript">'
,
"if (typeof qa_wysiwyg_editor_config == 'object')"
,
"
\t
qa_wysiwyg_editor_config.skin='kama';"
,
'</script>'
);
}
if
(
isset
(
$login
)
&&
!
QA_FINAL_EXTERNAL_USERS
)
{
$this
->
output
(
'<!--[Begin: login form]-->'
,
'<form id="qa-loginform" action="'
.
$login
[
'url'
]
.
'" method="post">'
,
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'
.
trim
(
qa_lang_html
(
qa_opt
(
'allow_login_email_only'
)
?
'users/email_label'
:
'users/email_handle_label'
),
':'
)
.
'" />'
,
'<input type="password" id="qa-password" name="password" placeholder="'
.
trim
(
qa_lang_html
(
'users/password_label'
),
':'
)
.
'" />'
,
'<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>'
,
'<label for="qa-rememberme" id="qa-remember">'
.
qa_lang_html
(
'users/remember'
)
.
'</label></div>'
,
'<input type="hidden" name="code" value="'
.
qa_html
(
qa_get_form_security_code
(
'login'
))
.
'"/>'
,
'<input type="submit" value="'
.
$login
[
'label'
]
.
'" id="qa-login" name="dologin" />'
,
'</form>'
,
'<!--[End: login form]-->'
);
function
nav_user_search
()
// outputs login form if user not logged in
{
if
(
!
qa_is_logged_in
())
{
$login
=@
$this
->
content
[
'navigation'
][
'user'
][
'login'
];
if
(
isset
(
$login
)
&&
!
QA_FINAL_EXTERNAL_USERS
)
{
$this
->
output
(
'<!--[Begin: login form]-->'
,
'<form id="qa-loginform" action="'
.
$login
[
'url'
]
.
'" method="post">'
,
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'
.
trim
(
qa_lang_html
(
qa_opt
(
'allow_login_email_only'
)
?
'users/email_label'
:
'users/email_handle_label'
),
':'
)
.
'" />'
,
'<input type="password" id="qa-password" name="password" placeholder="'
.
trim
(
qa_lang_html
(
'users/password_label'
),
':'
)
.
'" />'
,
'<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>'
,
'<label for="qa-rememberme" id="qa-remember">'
.
qa_lang_html
(
'users/remember'
)
.
'</label></div>'
,
'<input type="hidden" name="code" value="'
.
qa_html
(
qa_get_form_security_code
(
'login'
))
.
'"/>'
,
'<input type="submit" value="'
.
$login
[
'label'
]
.
'" id="qa-login" name="dologin" />'
,
'</form>'
,
'<!--[End: login form]-->'
);
unset
(
$this
->
content
[
'navigation'
][
'user'
][
'login'
]);
// removes regular navigation link to log in page
}
unset
(
$this
->
content
[
'navigation'
][
'user'
][
'login'
]);
// removes regular navigation link to log in page
}
qa_html_theme_base
::
nav_user_search
();
}
function
logged_in
()
{
if
(
qa_is_logged_in
())
// output user avatar to login bar
$this
->
output
(
'<div class="qa-logged-in-avatar">'
,
QA_FINAL_EXTERNAL_USERS
?
qa_get_external_avatar_html
(
qa_get_logged_in_userid
(),
24
,
true
)
:
qa_get_user_avatar_html
(
qa_get_logged_in_flags
(),
qa_get_logged_in_email
(),
qa_get_logged_in_handle
(),
qa_get_logged_in_user_field
(
'avatarblobid'
),
qa_get_logged_in_user_field
(
'avatarwidth'
),
qa_get_logged_in_user_field
(
'avatarheight'
),
24
,
true
),
'</div>'
);
qa_html_theme_base
::
nav_user_search
();
}
qa_html_theme_base
::
logged_in
();
function
logged_in
()
{
if
(
qa_is_logged_in
())
// output user avatar to login bar
$this
->
output
(
'<div class="qa-logged-in-avatar">'
,
QA_FINAL_EXTERNAL_USERS
?
qa_get_external_avatar_html
(
qa_get_logged_in_userid
(),
24
,
true
)
:
qa_get_user_avatar_html
(
qa_get_logged_in_flags
(),
qa_get_logged_in_email
(),
qa_get_logged_in_handle
(),
qa_get_logged_in_user_field
(
'avatarblobid'
),
qa_get_logged_in_user_field
(
'avatarwidth'
),
qa_get_logged_in_user_field
(
'avatarheight'
),
24
,
true
),
'</div>'
);
if
(
qa_is_logged_in
())
{
// adds points count after logged in username
$userpoints
=
qa_get_logged_in_points
();
qa_html_theme_base
::
logged_in
();
$pointshtml
=
(
$userpoints
==
1
)
?
qa_lang_html_sub
(
'main/1_point'
,
'1'
,
'1'
)
:
qa_lang_html_sub
(
'main/x_points'
,
qa_html
(
number_format
(
$userpoints
)));
if
(
qa_is_logged_in
())
{
// adds points count after logged in username
$userpoints
=
qa_get_logged_in_points
();
$this
->
output
(
'<span class="qa-logged-in-points">'
,
'('
.
$pointshtml
.
')'
,
'</span>'
);
}
}
$pointshtml
=
(
$userpoints
==
1
)
?
qa_lang_html_sub
(
'main/1_point'
,
'1'
,
'1'
)
:
qa_lang_html_sub
(
'main/x_points'
,
qa_html
(
number_format
(
$userpoints
)));
function
body_header
()
// adds login bar, user navigation and search at top of page in place of custom header content
{
$this
->
output
(
'<div id="qa-login-bar"><div id="qa-login-group">'
);
$this
->
nav_user_search
();
$this
->
output
(
'</div></div>'
);
}
function
header_custom
()
// allows modification of custom element shown inside header after logo
{
if
(
isset
(
$this
->
content
[
'body_header'
]))
{
$this
->
output
(
'<div class="header-banner">'
);
$this
->
output_raw
(
$this
->
content
[
'body_header'
]);
$this
->
output
(
'</div>'
);
}
$this
->
output
(
'<span class="qa-logged-in-points">'
,
'('
.
$pointshtml
.
')'
,
'</span>'
);
}
}
function
header
()
// removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
{
$this
->
output
(
'<div class="qa-header">'
);
// adds login bar, user navigation and search at top of page in place of custom header content
function
body_header
()
{
$this
->
output
(
'<div id="qa-login-bar"><div id="qa-login-group">'
);
$this
->
nav_user_search
();
$this
->
output
(
'</div></div>'
);
}
$this
->
logo
();
$this
->
header_clear
();
$this
->
header_custom
();
// allows modification of custom element shown inside header after logo
function
header_custom
()
{
if
(
isset
(
$this
->
content
[
'body_header'
]))
{
$this
->
output
(
'<div class="header-banner">'
);
$this
->
output_raw
(
$this
->
content
[
'body_header'
]);
$this
->
output
(
'</div>'
);
}
}
$this
->
output
(
'</div> <!-- END qa-header -->'
,
''
);
// removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
function
header
()
{
$this
->
output
(
'<div class="qa-header">'
);
$this
->
output
(
'<div class="qa-main-shadow">'
,
''
);
$this
->
output
(
'<div class="qa-main-wrapper">'
,
''
);
$this
->
nav_main_sub
();
$this
->
logo
(
);
$this
->
header_clear
(
);
$this
->
header_custom
();
}
$this
->
output
(
'</div> <!-- END qa-header -->'
,
''
);
function
sidepanel
()
// removes sidebar for user profile pages
{
if
(
$this
->
template
!=
'user'
)
qa_html_theme_base
::
sidepanel
();
}
$this
->
output
(
'<div class="qa-main-shadow">'
,
''
);
$this
->
output
(
'<div class="qa-main-wrapper">'
,
''
);
$this
->
nav_main_sub
();
function
footer
()
// prevent display of regular footer content (see body_suffix()) and replace with closing new <div>s
{
$this
->
output
(
'</div> <!-- END main-wrapper -->'
);
$this
->
output
(
'</div> <!-- END main-shadow -->'
);
}
}
function
title
()
// add RSS feed icon after the page title
{
qa_html_theme_base
::
title
();
// removes sidebar for user profile pages
function
sidepanel
()
{
if
(
$this
->
template
!=
'user'
)
qa_html_theme_base
::
sidepanel
();
}
$feed
=@
$this
->
content
[
'feed'
];
// prevent display of regular footer content (see body_suffix()) and replace with closing new <div>s
function
footer
()
{
$this
->
output
(
'</div> <!-- END main-wrapper -->'
);
$this
->
output
(
'</div> <!-- END main-shadow -->'
);
}
if
(
!
empty
(
$feed
))
$this
->
output
(
'<a href="'
.
$feed
[
'url'
]
.
'" title="'
.@
$feed
[
'label'
]
.
'"><img src="'
.
$this
->
rooturl
.
'images/rss.jpg" alt="" width="16" height="16" border="0" class="qa-rss-icon"/></a>'
);
}
// add RSS feed icon after the page title
function
title
()
{
qa_html_theme_base
::
title
();
function
q_item_stats
(
$q_item
)
// add view count to question list
{
$this
->
output
(
'<div class="qa-q-item-stats">'
);
$feed
=@
$this
->
content
[
'feed'
];
$this
->
voting
(
$q_item
);
$this
->
a_count
(
$q_item
);
qa_html_theme_base
::
view_count
(
$q_item
);
if
(
!
empty
(
$feed
))
$this
->
output
(
'<a href="'
.
$feed
[
'url'
]
.
'" title="'
.@
$feed
[
'label'
]
.
'"><img src="'
.
$this
->
rooturl
.
'images/rss.jpg" alt="" width="16" height="16" border="0" class="qa-rss-icon"/></a>'
);
}
$this
->
output
(
'</div>'
);
}
// add view count to question list
function
q_item_stats
(
$q_item
)
{
$this
->
output
(
'<div class="qa-q-item-stats">'
);
function
view_count
(
$q_item
)
// prevent display of view count in the usual place
{
if
(
$this
->
template
==
'question'
)
qa_html_theme_base
::
view_count
(
$q_item
);
}
$this
->
voting
(
$q_item
);
$this
->
a_count
(
$q_item
);
qa_html_theme_base
::
view_count
(
$q_item
);
function
body_suffix
()
// to replace standard Q2A footer
{
$this
->
output
(
'<div class="qa-footer-bottom-group">'
);
qa_html_theme_base
::
footer
();
$this
->
output
(
'</div> <!-- END footer-bottom-group -->'
,
''
);
}
$this
->
output
(
'</div>'
);
}
function
attribution
()
{
$this
->
output
(
'<div class="qa-attribution">'
,
' | Snow Theme by <a href="http://www.q2amarket.com">Q2A Market</a>'
,
'</div>'
);
// prevent display of view count in the usual place
function
view_count
(
$q_item
)
{
if
(
$this
->
template
==
'question'
)
qa_html_theme_base
::
view_count
(
$q_item
);
}
qa_html_theme_base
::
attribution
();
}
// to replace standard Q2A footer
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
()
{
$this
->
output
(
'<div class="qa-attribution">'
,
' | Snow Theme by <a href="http://www.q2amarket.com">Q2A Market</a>'
,
'</div>'
);
qa_html_theme_base
::
attribution
();
}
}
/*
Omit PHP closing tag to help avoid accidental output
...
...
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