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
feb6adf8
Commit
feb6adf8
authored
Feb 02, 2015
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed qam-snow-theme.php file and all global variables in the theme
parent
00ec8f3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
337 deletions
+49
-337
qam-snow-theme.php
qa-theme/SnowFlat/inc/qam-snow-theme.php
+0
-309
qa-theme.php
qa-theme/SnowFlat/qa-theme.php
+49
-28
No files found.
qa-theme/SnowFlat/inc/qam-snow-theme.php
deleted
100755 → 0
View file @
00ec8f3a
<?php
/*
Snow Theme for Question2Answer Package
Copyright (C) 2014 Q2A Market <http://www.q2amarket.com>
File: inc/qam-snow-theme.php
Version: Snow 1.4
Description: Snow theme core class
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
/**
* Snow theme loader class
*
* This class loads all required data for the Snow theme. This is written more
* for future use and to keep untouched <code>qa_html_theme_base</code>
*
* @package Snow
* @subpackage Loader
* @category Theme
* @since Snow 1.4
* @version 1.0
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
class
qam_snow_theme
{
/**
* @var array Holds the data
*/
private
$data
;
/**
* Snow instance
*
* @access public
* @since Snow 1.4
* @version 1.0
*
* @static $instance
*
* @uses qam_snow_theme::setup_globals() Setup require globals
* @uses qam_snow_theme::includes() Include require files
* @uses qam_snow_theme::heads() Setup <code><head></code> elements
* @uses qam_snow_theme::set_options() Setup dynamic options for Snow
* @uses qam_snow_theme::headers() Setup header elements
* @uses qam_snow_theme::footers() Setup footer elements
*
* @see qam_snow_theme()
* @return mixed all qam_snow_theme
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
public
static
function
instance
()
{
// Store the instance locally to avoid private static replication
static
$instance
=
null
;
// Only run these methods if they haven't been run previously
if
(
null
===
$instance
)
{
$instance
=
new
qam_snow_theme
;
$instance
->
setup_globals
();
$instance
->
includes
();
// $instance->heads();
$instance
->
get_options
();
$instance
->
headers
();
// $instance->footers();
}
// Always return the instance
return
$instance
;
}
/**
* Class construct
*/
private
function
__construct
()
{
/* Do nothing here */
}
/**
*
* @param type $key
* @return type
*/
public
function
__isset
(
$key
)
{
return
isset
(
$this
->
data
[
$key
]);
}
/**
*
* @param type $key
* @return type
*/
public
function
__get
(
$key
)
{
return
isset
(
$this
->
data
[
$key
])
?
$this
->
data
[
$key
]
:
null
;
}
/**
*
* @param type $key
* @param type $value
*/
public
function
__set
(
$key
,
$value
)
{
$this
->
data
[
$key
]
=
$value
;
}
/**
*
* @param type $key
*/
public
function
__unset
(
$key
)
{
if
(
isset
(
$this
->
data
[
$key
]))
{
unset
(
$this
->
data
[
$key
]);
}
}
/**
*
* @param type $name
* @param type $args
* @return null
*/
public
function
__call
(
$name
=
''
,
$args
=
array
())
{
unset
(
$name
,
$args
);
return
null
;
}
/**
* Snow theme globals
*
* @access private
* @since Snow 1.4
* @version 1.0
*
* @author Q2A Market <www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
setup_globals
()
{
$this
->
theme
=
qa_opt
(
'site_theme'
);
$this
->
author
=
$this
->
qam_opt
(
'snow_author'
,
'Q2A Market'
);
$this
->
author_url
=
$this
->
qam_opt
(
'snow_author_url'
,
'http://www.q2amarket.com'
);
$this
->
version
=
$this
->
qam_opt
(
'snow_version'
,
'1.4-beta'
);
$this
->
snow_version
=
strtolower
(
$this
->
theme
.
'-'
.
$this
->
version
);
$this
->
opt_prefix
=
'qam_snow_'
;
$this
->
js_dir
=
'js/'
;
$this
->
css_dir
=
'css/'
;
$this
->
img_url
=
'images/'
;
$this
->
icon_url
=
$this
->
img_url
.
'icons/'
;
}
/**
* Incldue require files
*
* @access private
* @since Snow 1.4
* @version 1.0
*
* @author Q2A Market <www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
includes
()
{
//do nothing now
}
/**
* Get theme options for customization.
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return array|mixed theme options value
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
get_options
()
{
$this
->
data
[
'ask_search_box_color'
]
=
$this
->
qam_opt
(
'ask_search_box_color'
);
$this
->
data
[
'welcome_widget_color'
]
=
$this
->
qam_opt
(
'welcome_widget_color'
);
$this
->
data
[
'fixed_topbar'
]
=
((
$this
->
qam_opt
(
'fixed_topbar'
))
?
'fixed'
:
null
);
$this
->
data
[
'header_custom_content'
]
=
$this
->
qam_opt
(
'header_custom_content'
);
$this
->
data
[
'footer_custom_content'
]
=
$this
->
qam_opt
(
'above_footer_custom_content'
);
return
$this
->
data
;
}
/**
* Get header items
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return array|mixed various header items (e.g. user account, scripts)
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
headers
()
{
$this
->
data
[
'headers'
]
=
array
(
'user_points'
=>
$this
->
user_points
(),
'ask_button'
=>
$this
->
ask_button
(),
);
return
$this
->
data
;
}
/**
* Get logged in user's points
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string|null LoggedIn user's total points, null for guest
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
user_points
()
{
if
(
qa_is_logged_in
())
{
$userpoints
=
qa_get_logged_in_points
();
$pointshtml
=
(
$userpoints
==
1
)
?
qa_lang_html_sub
(
'main/1_point'
,
'1'
,
'1'
)
:
qa_html
(
number_format
(
$userpoints
));
$points
=
'<DIV CLASS="qam-logged-in-points">'
.
$pointshtml
.
'</DIV>'
;
return
$points
;
}
return
null
;
}
/**
* Custom ask button for medium and small screen
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string Ask button html markup
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
private
function
ask_button
()
{
$html
=
'<div class="qam-ask-search-box">'
;
$html
.=
'<div class="qam-ask-mobile"><a href="'
.
qa_path
(
'ask'
,
null
,
qa_path_to_root
())
.
'" class="'
.
$this
->
qam_opt
(
'ask_search_box_color'
)
.
'">'
.
qa_lang_html
(
'main/nav_ask'
)
.
'</a></div>'
;
$html
.=
'<div class="qam-search-mobile '
.
$this
->
qam_opt
(
'ask_search_box_color'
)
.
'" id="qam-search-mobile"></div>'
;
$html
.=
'</div>'
;
return
$html
;
}
}
/* ---------------------------------------------------------------------------- */
// create a function to instanciate the class
if
(
!
function_exists
(
'qam_snow_theme'
))
{
/**
* Return <code>qam_snow_theme</code> class instance
*
* @access public
* @since Snow 1.4
* @version 1.0
* @return array
*
* @author Q2A Market <http://www.q2amarket.com>
* @copyright (c) 2014, Q2A Market
* @license http://www.gnu.org/copyleft/gpl.html
*/
function
qam_snow_theme
()
{
return
qam_snow_theme
::
instance
();
}
}
// Declare global variable
if
(
class_exists
(
'qam_snow_theme'
))
{
$GLOBALS
[
'qam_snow'
]
=
qam_snow_theme
();
}
qa-theme/SnowFlat/qa-theme.php
View file @
feb6adf8
...
...
@@ -34,6 +34,11 @@
*/
class
qa_html_theme
extends
qa_html_theme_base
{
private
$fixed_topbar
=
false
;
private
$welcome_widget_class
=
'turquoise'
;
private
$ask_search_box_class
=
'turquoise'
;
/**
* @since Snow 1.4
* @param type $template
...
...
@@ -49,15 +54,12 @@ class qa_html_theme extends qa_html_theme_base
$this
->
js_dir
=
'js/'
;
$this
->
img_url
=
'images/'
;
$this
->
icon_url
=
$this
->
img_url
.
'icons/'
;
require_once
(
'inc/qam-snow-theme.php'
);
}
/**
* Adding aditional meta for responsive design
*
* @since Snow 1.4
* @global type $qam_snow
*/
public
function
head_metas
()
{
...
...
@@ -102,14 +104,11 @@ class qa_html_theme extends qa_html_theme_base
* Adding point count for logged in user
*
* @since Snow 1.4
* @global array $qam_snow
*/
public
function
logged_in
()
{
global
$qam_snow
;
parent
::
logged_in
();
$this
->
output
(
$qam_snow
->
headers
[
'user_points'
]);
$this
->
output
(
$this
->
user_points
());
}
/**
...
...
@@ -130,17 +129,12 @@ class qa_html_theme extends qa_html_theme_base
}
/**
* Adding body class dynamically
*
* override to add class on admin/approve-users page
* Adding body class dynamically. Override needed to add class on admin/approve-users page
*
* @since Snow 1.4
* @return string body class
*/
public
function
body_tags
()
{
global
$qam_snow
;
$class
=
'qa-template-'
.
qa_html
(
$this
->
template
);
if
(
isset
(
$this
->
content
[
'categoryids'
]))
{
...
...
@@ -155,8 +149,8 @@ class qa_html_theme extends qa_html_theme_base
$class
.=
' qam-approve-users'
;
}
if
(
isset
(
$qam_snow
->
fixed_topbar
)
)
$class
.=
' qam-body-
'
.
$qam_snow
->
fixed_topbar
;
if
(
$this
->
fixed_topbar
)
$class
.=
' qam-body-
fixed'
;
$this
->
output
(
'class="'
.
$class
.
' qa-body-js-off"'
);
}
...
...
@@ -273,15 +267,14 @@ class qa_html_theme extends qa_html_theme_base
*/
public
function
header
()
{
global
$qam_snow
;
$class
=
$this
->
fixed_topbar
?
' fixed'
:
''
;
$class
=
isset
(
$qam_snow
->
fixed_topbar
)
?
' '
.
$qam_snow
->
fixed_topbar
:
''
;
$this
->
output
(
'<div id="qam-topbar" class="clearfix'
.
$class
.
'">'
);
$this
->
nav_main_sub
();
$this
->
output
(
'</div><!-- END qam-topbar -->'
);
$this
->
output
(
$
qam_snow
->
headers
[
'ask_button'
]
);
$this
->
output
(
$
this
->
ask_button
()
);
$this
->
qam_search
(
'the-top'
,
'the-top-search'
);
}
...
...
@@ -292,10 +285,6 @@ class qa_html_theme extends qa_html_theme_base
*/
public
function
footer
()
{
// to replace standard Q2A footer
global
$qam_snow
;
$this
->
output
(
$qam_snow
->
footer_custom_content
);
$this
->
output
(
'<div class="qam-footer-box">'
);
$this
->
output
(
'<div class="qam-footer-row">'
);
...
...
@@ -303,7 +292,7 @@ class qa_html_theme extends qa_html_theme_base
$this
->
output
(
'</div> <!-- END qam-footer-row -->'
);
parent
::
footer
();
$this
->
output
(
'</div> <!-- END qam-footer-box -->'
,
''
);
$this
->
output
(
'</div> <!-- END qam-footer-box -->'
);
}
/**
...
...
@@ -334,16 +323,13 @@ class qa_html_theme extends qa_html_theme_base
* To provide various color option
*
* @since Snow 1.4
* @global array $qam_snow
*/
public
function
sidebar
()
{
global
$qam_snow
;
if
(
isset
(
$this
->
content
[
'sidebar'
]))
{
$sidebar
=
$this
->
content
[
'sidebar'
];
if
(
!
empty
(
$sidebar
))
{
$this
->
output
(
'<div class="qa-sidebar wet-asphalt '
.
$
qam_snow
->
welcome_widget_color
.
'">'
);
$this
->
output
(
'<div class="qa-sidebar wet-asphalt '
.
$
this
->
welcome_widget_class
.
'">'
);
$this
->
output_raw
(
$sidebar
);
$this
->
output
(
'</div>'
,
''
);
}
...
...
@@ -547,7 +533,6 @@ class qa_html_theme extends qa_html_theme_base
* I'd really appreciate you displaying this link on your Q2A site. Thank you - Jatin
*
* @since Snow 1.4
* @global array $qam_snow
*/
public
function
attribution
()
{
...
...
@@ -666,4 +651,40 @@ class qa_html_theme extends qa_html_theme_base
$this
->
output_array
(
$css
);
}
/**
* Get logged in user's points
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string|null LoggedIn user's total points, null for guest
*/
private
function
user_points
()
{
if
(
qa_is_logged_in
())
{
$userpoints
=
qa_get_logged_in_points
();
$pointshtml
=
(
$userpoints
==
1
)
?
qa_lang_html_sub
(
'main/1_point'
,
'1'
,
'1'
)
:
qa_html
(
number_format
(
$userpoints
));
$points
=
'<DIV CLASS="qam-logged-in-points">'
.
$pointshtml
.
'</DIV>'
;
return
$points
;
}
return
null
;
}
/**
* Custom ask button for medium and small screen
*
* @access private
* @since Snow 1.4
* @version 1.0
* @return string Ask button html markup
*/
private
function
ask_button
()
{
$html
=
'<div class="qam-ask-search-box">'
;
$html
.=
'<div class="qam-ask-mobile"><a href="'
.
qa_path
(
'ask'
,
null
,
qa_path_to_root
())
.
'" class="'
.
$this
->
ask_search_box_class
.
'">'
.
qa_lang_html
(
'main/nav_ask'
)
.
'</a></div>'
;
$html
.=
'<div class="qam-search-mobile '
.
$this
->
ask_search_box_class
.
'" id="qam-search-mobile"></div>'
;
$html
.=
'</div>'
;
return
$html
;
}
}
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