Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Gamexls
- *
- * @author Megatemas
- * @uri http://www.megatemas.com/
- *
- * @package WordPress
- * @subpackage GameXlS
- */
- /** Include buddypress integration file **/
- include_once('inc/buddypress.php');
- /** Include setup theme **/
- require_once (TEMPLATEPATH.'/inc/setup.php');
- /** Include option panel **/
- require_once(TEMPLATEPATH.'/inc/admin/config.php');
- /** Include theme actions API **/
- include_once('inc/actions.php');
- /** Include MyArcadePlugin Theme API **/
- include_once(TEMPLATEPATH.'/inc/myarcade_api.php');
- /** Include custom widgets **/
- include_once('inc/myabp_widgets.php');
- /** Include TGM Plugin Activation **/
- if(is_admin()){include_once (TEMPLATEPATH.'/inc/admin/plugins/plugins.php');}
- if ( !is_admin() ) {
- add_action('wp_print_scripts', 'gamexls_scripts_init');
- add_action('wp_print_styles', 'gamexls_stylesheet_init');
- }
- add_filter('avatar_defaults', 'mt_gravatar');
- function mt_gravatar ($avatar_defaults) {
- $myavatar = get_bloginfo('template_directory').'/img/cnt/imgusr.jpg';
- $avatar_defaults[$myavatar] = __('Avatar MT','gamexls');
- return $avatar_defaults;
- }
- function gamexls_default_menu() {
- wp_list_categories('sort_column=name&title_li=&depth=1&number=5');
- }
- function gamexls_sidebar($type){
- if( gamexls_get_option( 'layout', 2 ) ==2 and $type==1){
- return 'flol';
- }elseif( gamexls_get_option( 'layout', 2 ) ==2 and $type==2){
- return 'flor';
- }elseif( gamexls_get_option( 'layout', 2 ) ==1 and $type==1){
- return 'flor';
- }elseif( gamexls_get_option( 'layout', 2 ) ==1 and $type==2){
- return 'flol';
- }
- }
- function gamexls_social($class=NULL,$up=NULL){
- if( gamexls_get_option( 'mtfacebook', '#' ) !='' or gamexls_get_option( 'mttwitter', '#' )!='' or gamexls_get_option( 'mtyoutube', '#' )!='' or gamexls_get_option( 'mtgoogleplus', '#' )!=''){
- ?>
- <ul class="<?php if($class==''){ ?>lstsoc anmtins flli flor<?php }else{ echo $class; } ?>">
- <?php if( gamexls_get_option( 'mtfacebook', '#' )!=''){ ?><li><a target="_blank" href="<?php echo gamexls_get_option( 'mtfacebook', '#' ); ?>" class="bgbl-50 icon-rnd15" title="<?php _e('Facebook','gamexls'); ?>"></a></li><?php } ?>
- <?php if( gamexls_get_option( 'mttwitter', '#' )!=''){ ?><li><a target="_blank" href="<?php echo gamexls_get_option( 'mttwitter', '#' ); ?>" class="bgbl-50 icon-rnd15" title="<?php _e('Twitter','gamexls'); ?>"></a></li><?php } ?>
- <?php if( gamexls_get_option( 'mtyoutube', '#' )!=''){ ?><li><a target="_blank" href="<?php echo gamexls_get_option( 'mtyoutube', '#' ); ?>" class="bgbl-50 icon-rnd15" title="<?php _e('Youtube','gamexls'); ?>"></a></li><?php } ?>
- <?php if( gamexls_get_option( 'mtgoogleplus', '#' )!=''){ ?><li><a target="_blank" href="<?php echo gamexls_get_option( 'mtgoogleplus', '#' ); ?>" class="bgbl-50 icon-rnd15" title="<?php _e('Google+','gamexls'); ?>"></a></li><?php } ?>
- <?php if($up==1){ ?><li><a href="#hd" class="bgbl-50 icon-rnd15" title="<?php _e('Up','gamexls'); ?>"></a></li><?php } ?>
- </ul>
- <?php
- }
- }
- function mt_plugin_exists($fun){
- if (function_exists($fun)) {
- return 'success';
- } else {
- return 'warning';
- }
- }
- if(is_admin()){
- function rkv_imagelink_setup() {
- $image_set = get_option( 'image_default_link_type' );
- if ($image_set !== 'none') {
- update_option('image_default_link_type', 'none');
- }
- }
- add_action('admin_init', 'rkv_imagelink_setup', 10);
- }
- if ( !function_exists('gamexls_favorite_link') ) {
- function myabp_favorite_link($post_id, $opt, $action) {
- $link = '<li><span class="wpfp-span"><img src="'.plugins_url('wp-favorite-posts/img/loading.gif').'" alt="'.__('Loading','gamexls').'" title="'.__('Loading','gamexls').'" class="wpfp-hide wpfp-img"><a class="wpfp-link bgbl-50 icon-rnd15 mtfav-'.$action.'" href="?wpfpaction='.$action.'&postid='.$post_id.'" title="'.$opt.'" rel="nofollow"></a></span></li>';
- $link = apply_filters( 'wpfp_link_html', $link );
- return $link;
- }
- }
- function gamexls_contest_alert() {
- if ( !function_exists('myarcadecontest_get_contest_id_for_this_game') )
- return;
- $contest_id = myarcadecontest_get_contest_id_for_this_game();
- $user_id = get_current_user_id();
- if (!$contest_id || myarcadecontest_check_user_is_in_contest($contest_id, $user_id) )
- return;
- $permalink_open = '<a href="'.get_permalink($contest_id).'" title="'.get_the_title($contest_id).'">';
- $permalink_close = '</a>';
- ?>
- <div class="gam_info">
- <p>
- <strong><?php _e('Howdy!', 'gamexls'); ?></strong> <?php echo sprintf( __('There is an active contest available for this game. Click %shere%s to join the contest!', 'gamexls'), $permalink_open, $permalink_close); ?>
- </p>
- </div>
- <?php
- }
- function gamexls_get_leaderboard() {
- global $wpdb;
- $output = '';
- $results = $wpdb->get_results("SELECT h.user_id, COUNT(*) as highscores, u.plays as plays
- FROM ".MYARCADE_HIGHSCORES_TABLE." AS h
- INNER JOIN ".MYARCADE_USER_TABLE." AS u ON h.user_id=u.user_id
- GROUP BY h.user_id
- ORDER BY highscores DESC LIMIT 3");
- if (!empty($results)) {
- $count = 0;
- foreach ($results as $result) {
- $count++;
- $plays=0;
- echo'
- <li class="bgc2">
- <figure class="cirl-imgusrcn bgwh-10">'.get_avatar($result->user_id, 116).'</figure>
- <p>'.myscore_get_user_link($result->user_id).'</p>
- <strong class="iconb-game icon50 bgwh-10">'.$result->plays.' <span>'.__('Plays','gamexls').'</span></strong>
- <strong class="iconb-trop bgwh-10 award-'.$count.'">'.$result->highscores.' <span>'.__('Scores','gamexls').'</span></strong>
- <span class="posit-rnd10">#'.$count.'</span>
- </li>
- ';
- }
- }
- }
- function gamexls_h1($class=NULL) {
- if(is_single()){
- return '<h1'.$class.'>'.get_the_title(get_the_ID()).'</h1>';
- }elseif(is_page()){
- return '<h1'.$class.'>'.get_the_title(get_the_ID()).'</h1>';
- }elseif(is_search()){
- return '<h1'.$class.'>'.get_search_query().'</h1>';
- }elseif(is_category()){
- return '<h1'.$class.'>'.single_cat_title("", false).'</h1>';
- }elseif(is_tag()){
- return '<h1'.$class.'>'.single_tag_title("", false).'</h1>';
- }elseif(is_home() or is_front_page()){
- return '<h1'.$class.'>'.get_option('blogname').'</h1>';
- }else{
- return '<h1'.$class.'>'.wp_title("",false,"right").'</h1>';
- }
- }
- function gamexls_header($class=NULL) {
- if(is_single()){
- return '<div'.$class.'>'.get_the_title(get_the_ID()).'</div>';
- }elseif(is_page()){
- return '<h1'.$class.'>'.get_the_title(get_the_ID()).'</h1>';
- }elseif(is_search()){
- return '<h1'.$class.'>'.get_search_query().'</h1>';
- }elseif(is_category()){
- return '<h1'.$class.'>'.single_cat_title("", false).'</h1>';
- }elseif(is_tag()){
- return '<h1'.$class.'>'.single_tag_title("", false).'</h1>';
- }elseif(is_home() or is_front_page()){
- return '<h1'.$class.'>'.get_option('blogname').'</h1>';
- }else{
- return '<h1'.$class.'>'.wp_title("",false,"right").'</h1>';
- }
- }
- function gamexls_breadcumb() {
- if ( is_home() || is_front_page() )
- return;
- if(is_single()){
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.get_the_category_list(', ','',get_the_ID()).'</strong> <strong>'.get_the_title(get_the_ID()).'</strong>
- </div>
- ';
- }elseif(is_page()){
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.get_the_title(get_the_ID()).'</strong>
- </div>
- ';
- }elseif(is_search()){
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.get_search_query().'</strong>
- </div>
- ';
- }elseif(is_category()){
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.single_cat_title("", false).'</strong>
- </div>
- ';
- }elseif(is_tag()){
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.single_tag_title("", false).'</strong>
- </div>
- ';
- }else{
- return '
- <div class="brdcrm">
- <a title="'.__('Home','gamexls').'" href="'.esc_url( home_url( '/' ) ).'" class="iconb-home"><span class="notx">'.__('Home','gamexls').'</span></a> <strong>'.wp_title("",false,"right").'</strong>
- </div>
- ';
- }
- }
- function set_mt_cookie() {
- if (isset($_POST['idc'])) {
- setcookie('idc', '', time()-1209600);
- setcookie('idc', intval($_POST['idc']), time()+1209600, COOKIEPATH, COOKIE_DOMAIN, false);
- }
- }
- add_action( 'init', 'set_mt_cookie');
- function mt_paginacion($tipo=1,$class=NULL,$qc=NULL){
- global $wp_query,$paged;
- if($qc==''){$total=$wp_query->max_num_pages;}else{$total=$qc;}
- if($tipo==1){
- $paginacion=paginate_links( array(
- 'base' => str_replace(999999999, '%#%', esc_url( get_pagenum_link(999999999) ) ),
- 'format' => '?paged=%#%',
- 'current' => max( 1, $paged ),
- 'total' => $total,
- 'mid_size' => 3,
- 'prev_next' => false
- ) );
- }else{
- $paginacion=paginate_comments_links( array('prev_next' => true,'echo' => false) );
- }
- if(!empty($paginacion))echo'<div class="mt-pagnav'.$class.'">'.$paginacion.'</div>';
- }
- if ( !function_exists('gamexls_favorite') ) {
- function gamexls_favorite() {
- global $post, $action;
- // Works only when WP Favorite Post is active
- if (function_exists('wpfp_link')) {
- if ($action == "remove") {
- $str = myabp_favorite_link($post->ID, wpfp_get_option('remove_favorite'), "remove");
- } elseif ($action == "add") {
- $str = myabp_favorite_link($post->ID, wpfp_get_option('add_favorite'), "add");
- } elseif (wpfp_check_favorited($post->ID)) {
- $str = myabp_favorite_link($post->ID, wpfp_get_option('remove_favorite'), "remove");
- } else {
- $str = myabp_favorite_link($post->ID, wpfp_get_option('add_favorite'), "add");
- }
- echo $str;
- }
- }
- }
- function gamexls_display_buttons() {
- if ( ( gamexls_get_option( 'fullscreen-button', 1 ) == '1')
- ||( gamexls_get_option( 'lights-button', 1 ) == '1')
- ||( gamexls_get_option( 'favorite-button', 1 ) == '1')
- ||( gamexls_get_option( 'report-button', 1 ) == '1') ) {
- return true;
- }
- return false;
- }
- function gamexls_report(){
- echo'
- <input name="RBL_URL" type="hidden" value="'.get_bloginfo('url').$_SERVER['REQUEST_URI'].'">
- <span id="RBL_Element" role="button" class="bgbl-50 icon-rnd15" title="Report"></span>';
- }
- /**
- * Display related or random games
- */
- function gamexls_related($tipo=1) {
- if($tipo==1){
- echo '
- <!--<more games>-->
- <section class="blkcn mbot10px">
- <div class="blkhd"><strong>'.__("MORE GAMES", "gamexls").'</strong></div>
- <div class="mt-tbcn bgwh padd10px mbot10px">
- <ul class="lstabcn cowh ovhd">
- <!--<cntab3>-->
- <li class="scrlbr">
- <div>
- ';
- }
- if ( function_exists('related_entries') ) {
- related_entries();
- } else {
- get_template_part('games', 'random');
- }
- if($tipo==1){
- echo'
- </div>
- </li>
- <!--</cntab3>-->
- </ul>
- </div>
- <!--</lstabs>-->
- </section>
- <!--</more games>-->
- ';
- }
- }
- function gamexls_scripts_init() {
- global $wp_scripts;
- $path_to_theme = get_template_directory_uri();
- if ( !is_admin() ) {
- // load the jquery script
- wp_enqueue_script('jquery');
- /*
- if ( gamexls_get_option( 'gamexls_jquery_cdn', 1 ) == '1' ) {
- if ( is_a($wp_scripts, 'WP_Scripts') && isset($wp_scripts->registered['jquery']) ) {
- if ( isset($wp_scripts->registered['jquery']->ver) && $wp_scripts->registered['jquery']->ver ) {
- $google_jquery_url = ($_SERVER['SERVER_PORT'] == 443 ? "https" : "http") . "://ajax.googleapis.com/ajax/libs/jquery/". $wp_scripts->registered['jquery']->ver ."/jquery.min.js";
- $request = wp_remote_head( $google_jquery_url );
- if ( 200 === wp_remote_retrieve_response_code( $request ) ) {
- wp_deregister_script('jquery');
- wp_register_script('jquery', $google_jquery_url , false, null, false);
- }
- }
- }
- }
- */
- wp_enqueue_script('mt-scrlbr', $path_to_theme.'/js/scrlbr.js',array('jquery'),'1.0',true);
- wp_enqueue_script('mt-functions', $path_to_theme.'/js/functi.js',array('jquery'),'1.0',true);
- if(is_front_page() or is_home() or is_game()){
- wp_enqueue_script('mt-bxsldr', $path_to_theme.'/js/bxsldr.js',array('jquery'),'4.1.1',false);
- wp_enqueue_script('mt-slider', $path_to_theme.'/js/slider.js', '', '',false);
- }
- if ( is_singular() ) {
- if( gamexls_get_option( 'progress-bar', 1 ) =='1'){
- wp_enqueue_script('mt-progrs', $path_to_theme.'/js/progrs.js', '', '',false);
- }
- }
- if(is_category()){
- wp_enqueue_script('mt-order', $path_to_theme.'/js/order.js', '', '',false);
- }
- if (is_singular() && comments_open() && get_option('thread_comments') ){
- wp_enqueue_script( 'comment-reply' );
- }
- }
- }
- function gamexls_stylesheet_init() {
- $path_to_theme = get_template_directory_uri();
- if(defined('BP_VERSION')){
- wp_register_style('mt-BuddyPressIntegration', $path_to_theme.'/css/buddypress.css');
- wp_enqueue_style( 'mt-BuddyPressIntegration');
- }
- wp_register_style('mt-rsp', $path_to_theme.'/css/rsp.css');
- wp_enqueue_style( 'mt-rsp');
- wp_register_style('mt-opensans', '//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700');
- wp_enqueue_style( 'mt-opensans');
- if( gamexls_get_option( 'stylesheet', 'style.css' ) !='style.css'){
- wp_register_style( gamexls_get_option( 'stylesheet', 'style.css' ), $path_to_theme.'/css/'. gamexls_get_option( 'stylesheet', 'style.css' ) );
- wp_enqueue_style( gamexls_get_option( 'stylesheet', 'style.css' ));
- }
- }
- function mt_header(){
- if( gamexls_get_option( 'custom_header_code', '' ) !=''){echo stripslashes( gamexls_get_option( 'custom_header_code', '' ) )."\r";}
- $favicon = gamexls_get_option( 'favicon', '' );
- if ( is_array( $favicon ) ) {
- if( $favicon['url']!=''){echo"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"".$favicon['url']."\">\r";}
- }else{
- echo"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"".get_template_directory_uri()."/img/favico.ico\">\r";
- }
- }
- add_action('wp_head', 'mt_header');
- function mt_custom_css(){
- echo'<style type="text/css">';
- if( gamexls_get_option( 'share-button-hover', 1 ) ==1){
- echo '.shrbtncn:hover .lstshr-rnd15{width: auto;padding-left: 30px; padding-right:10px; overflow:inherit}';
- }
- else{
- echo '.shrbtncn .lstshr-rnd15{width: auto;padding-left: 30px; padding-right:10px; overflow:inherit}';
- }
- echo'</style>
- '."\n\r";
- if( gamexls_get_option( 'mtcustom-css', 2 ) == 1 ){
- $mtlinkcolor = gamexls_get_option( 'mtlink-color', array( 'regular' => '#333', 'hover' => '#FAC75A' ) );
- echo'
- <style type="text/css">
- /*
- Body Background Color
- Pick a background color for the theme (default: #E9E9EA).
- */
- body,.bx-controls,#bordeswf{background-color:'. gamexls_get_option( 'color-background', '#E9E9EA' ).'}
- .hdcn4 .bx-controls:before{border-bottom-color:'. gamexls_get_option( 'color-background', '#E9E9EA' ).'}
- .hdcn4 .bx-controls:after{border-bottom-color:'. gamexls_get_option( 'color-background', '#E9E9EA' ).'}
- /*
- Header Background Color 1*
- Pick a background color (default: #2E2F31)
- */
- .hdcn .hdcn1{background-color:'. gamexls_get_option( 'header-backgroundcl1', '#2E2F31' ).'}
- /*
- Header Background Color 2*
- Pick a background color (default: #3E4649)
- */
- .hdcn .hdcn2{background-color:'. gamexls_get_option( 'header-backgroundcl2', '#3E4649' ).'}
- /*
- Header Background Color 3*
- Pick a background color (default: #2E2F31)
- */
- .hdcn .hdcn3{background-color:'. gamexls_get_option( 'header-backgroundcl3', '#2E2F31' ).'}
- /*
- Header Background Color 4*
- Pick a background color (default: Transparent)
- */
- .hdcn .hdcn4{background-color:'. gamexls_get_option( 'header-backgroundcl4', 'transparent' ).'}
- /*
- Header 4 Title color*
- Pick a background color (default: #666)
- */
- .hdcn .hdcn4 h1{color:'. gamexls_get_option( 'header4-titlecolor', '#666' ).'}
- /*
- Footer Background Color 1*
- Pick a background color (default: #2E2F31)
- */
- .ftcn .ftcn1{background-color:'. gamexls_get_option( 'footer-colorcl1', '#2E2F31' ).'}
- /*
- Footer Background Color 2*
- Pick a background color (default: #3E4649)
- */
- .ftcn.bgc2{background-color:'. gamexls_get_option( 'footer-colorcl2', '#3E4649' ).'}
- /*
- Dark Background Color 1 (Base)
- Pick a background color (default: #2E2F31)
- */
- .bgc1,.blkcn-2 .blkhd,.widget_myscore_leaderboard .blkhd,a.morgms-rnd10,a.delnkrnd10,a.remove-parent,a.clrfav,.blkhd.bgc1,.widget_search .blkhd,.widget_mabp_user_login .blkhd,.comment-respond,.widget_gamexls_leaderboard .blkhd,.widget_display_search #bbp-search-form,.widget_display_search .blkhd,.bbp_widget_login .blkhd,.bbp_widget_login form,.bbp_widget_login .bbp-logged-in,.widget_myscore_leaderboard ul,.widget_search form,div.ui-dialog,.profile-fields td,#message-threads td,.buddypress .bdcn div.item-list-tabs,.buddypress.widget .blkhd,.buddypress.widget .widget-error,.buddypress.widget .item-list,.buddypress.widget .avatar-block,.buddypress.widget .item-options{background-color:'. gamexls_get_option( 'darkbg-colorcl1b', '#2E2F31' ).';}
- .txcmrnd10:before{border-right-color:'. gamexls_get_option( 'darkbg-colorcl1b', '#2E2F31' ).'}
- /*
- Dark Background Color 2 (Base)
- Pick a background color (default: #3E4649)
- */
- .bgc2,span.bx-controls-direction a,.ftcn1 a:hover,.blkhd,.tagcnt a,.tagcloud a,.blkcn-2 .mCSB_draggerContainer,.wp-pagenavi a,.wp-pagenavi span,.mt-pagnav a,.mt-pagnav span,.menusr > li > a,.post-blg section .wp-caption,.hdcn3 .botn-rnd15,[class*="botn"],.gam_info,.widget_myscore_leaderboard ul li .playerinfo,.acomment-options a,a.friendship-button, .generic-button a, .item-list .small a.button,.buddypress .bdcn div.activity-meta a,.buddypress .bdcn div#item-header,.buddypress .bdcn div.item-list-tabs ul li.current a,.buddypress .bdcn div.item-list-tabs ul li.selected a,.buddypress.widget .item-list li,#wp-calendar caption{background-color:'. gamexls_get_option( 'darkbg-colorcl2b', '#3E4649' ).'}
- @media all and (max-width: 960px)
- {
- .menuhd:before{background-color:'. gamexls_get_option( 'darkbg-colorcl2b', '#3E4649' ).';}
- }
- /*
- General Background Color
- Pick a color for Buttons, and other things (default: #23A96E)
- */
- .bgc3,[class*="botn"]:hover,button,input[type="submit"],.lstsoc a:hover,.lstsoc span#RBL_Element:hover,.menuhd > li:hover > a,span.bx-controls-direction a:hover,.imgame,.menuhd li ul,.mCSB_horizontal>.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar,.blkhd-lnks li:hover,.tagcnt a:hover,.tagcloud a:hover,.pstcnt .bx-controls-direction a,a.morgms-rnd10:hover,.wp-pagenavi span.current,.wp-pagenavi a:hover,.mt-pagnav a:hover,.mt-pagnav span.current,.menusr > li:hover > a,.menusr > li ul,.shrbtncn:hover .iconb-shar,a.mornd15:hover,.hdcn3 .botn-rnd15:hover,.item-meta .activity,#wp-calendar tbody td a,#wp-calendar tfoot #prev a,#wp-calendar tfoot #next a,#wp-calendar tfoot #prev a:hover,#wp-calendar tfoot #next a:hover,.item-list .small a.button:hover,.buddypress .bdcn div.activity-meta a:hover,.generic-button a:hover,.acomment-options a:hover,.buddypress .bdcn div.item-list-tabs ul li a span{background-color:'. gamexls_get_option( 'general-background', '#23A96E' ).'}
- .post-blg section blockquote{border-left-color:'. gamexls_get_option( 'general-background', '#23A96E' ).'}
- @media all and (max-width: 790px)
- {
- .lstcmnts li li{border-left:2px solid '. gamexls_get_option( 'general-background', '#23A96E' ).'}
- }
- @media all and (max-width: 960px)
- {
- .menuhd:hover:before,.menuhd,.menuhd li,.menuhd li a,
- div.shrbtncn ul.lstshr-rnd15{background-color: '. gamexls_get_option( 'general-background', '#23A96E' ).'!important;}
- }
- /*BG Forms: Text Fields*/
- /*Regular*/
- input[type="text"],
- input[type="password"],
- textarea,
- select{background-color:'. gamexls_get_option( 'bg-forms-text-regular', '#333' ).';}
- /*Focus*/
- input[type="text"]:focus,
- input[type="password"]:focus,
- textarea:focus,
- select:focus{background-color:'. gamexls_get_option( 'bg-forms-text-focus', '#444' ).'}
- /*Forms: Text Fields*/
- /*Color*/
- ::-webkit-input-placeholder{color:'. gamexls_get_option( 'forms-text-regular', '#999' ).';}
- :-moz-placeholder{color:'. gamexls_get_option( 'forms-text-regular', '#999' ).';}
- ::-moz-placeholder{color:'. gamexls_get_option( 'forms-text-regular', '#999' ).';}
- :-ms-input-placeholder{color:'. gamexls_get_option( 'forms-text-regular', '#999' ).';}
- /*Focus*/
- input[type="text"],
- input[type="password"],
- textarea,
- select{color:'. gamexls_get_option( 'forms-text-focus', '#fff' ).';}
- /*
- Links Color
- Pick a color for links
- Regular: #333333
- Hover: #23A96E
- */
- /*REGULAR*/
- a,.post-blg header p span a:hover,.gam-txt a,.blkhd-lnks a.active,.blkhd-lnks a.active:hover{color:'. $mtlinkcolor['regular'].'}
- /*HOVER*/
- a:hover,.clr1,.logo-txt span span,.hdcn1 h1:before,.hdcn1 div:before,[class*="lsticb"] li a:hover:before,[class*="lsticb"] li a:hover,.hdcn4 .brdcrm a:hover,ul.lstfavgms > li a:hover,.tagsft a:hover,.txcmrnd10 a:hover,.comment-reply-link:hover:before,#cancel-comment-reply-link:hover,.gam-txt a:hover,.shrbtncn strong.iconb-shar:before,.iconb-shar:before,div.ui-dialog .ui-icon-closethick:hover,.widget_categories ul li a:hover:before,.widget_archive ul li a:hover:before,.widget_recent_entries ul li a:hover:before,.widget_pages ul li a:hover:before,.widget_nav_menu li a:hover:before{color:'. $mtlinkcolor['hover'].'}
- /*
- Body General Color 1
- Pick a color (default: #666)
- */
- body,.lsticb-tro li,.hdcn4 h1,.gam-txt{color:'. gamexls_get_option( 'bd-general-c1', '#666' ).'}
- /*
- Body General Color 2
- Pick a color (default: #FFF)
- */
- .cowh,.cowh a,.cowh a:hover,.bx-controls-direction a i,.blkhd,.blkhd a,.imgame,.imgame a,.imgame a i,a.morgms-rnd10,a.morgms-rnd10:hover,.mt-pagnav,.mt-pagnav a,.mt-pagnav a:hover,.wp-pagenavi,.wp-pagenavi a,.wp-pagenavi a:hover,.lstfavgms li a.delnkrnd10:hover,ul.lstfavgms > li a.remove-parent:hover,.post-blg section .wp-caption,.txcmrnd10 a,div.frmsbcm form .intx,#cancel-comment-reply-link,#progressbar,.shrbtncn:hover strong.iconb-shar:before,.tagcloud a,.tagcloud a:hover,.comment-reply-title,.gam_info,.gam_info a,.gam_info:before,.widget_display_search,.bbp_widget_login form,.bbp-login-links a,.bbp-login-links a:hover,.bbp_widget_login .bbp-logged-in,.bbp_widget_login .bbp-logged-in a,.bbp_widget_login .bbp-logged-in a:hover,#item-header,.buddypress .bdcn table tr td.label,.embgam .blkhd+div p,.comment-respond form,.tagsft,.messages-notices,.txcmrnd10,div.ui-dialog{color:'. gamexls_get_option( 'bd-general-c2', '#FFF' ).'}
- /*
- Body General Color 3
- Pick a color (default: #ddd)
- */
- .leabrd li > strong span,.post-blg header p span:before,.post-blg header p time:before,article footer [class*="iconb"]:before,[class*="lsticb"] li a:before,.widget_categories ul li a:before,.widget_archive ul li a:before,.widget_recent_entries ul li a:before,.widget_pages ul li a:before,.widget_myscore_todays_scores ul li:before,.widget_myscore_latest_scores ul li:before,.widget_myscore_game_scores ul li :before,.widget_nav_menu li a:before,.widget_recent_comments ul li:before{color:'. gamexls_get_option( 'bd-general-c3', '#ddd' ).'}
- /*
- Body General Color 4
- Pick a color (default: #999)
- */
- article footer [class*="iconb"],.hdcn4 .brdcrm a,.hdcn4 .brdcrm strong,.post-blg header p span,.post-blg header p time,.post-blg header p span a,.post-blg section blockquote,.comment-reply-link:before,.bx-loading:before,.lstmtjq .loading:before,.votcnt .post-ratings+div+div,.videowidget,.widget_views ul,.widget_myscore_todays_scores ul,.widget_text .textwidget,.widget_rss ul,.widget_tag_cloud .tagcloud,.widget_ratings-widget ul,.widget_pages ul,.widget_meta ul,.widget_myarcadecontest_active_contest ul,.widget_myscore_most_active_players ul,.widget_nav_menu ul,.widget_myscore_game_scores ul,.widget_myscore_latest_scores ul,.widget_recent_entries ul,.widget_recent_comments ul,.widget_categories ul,.widget_archive ul,.widget_display_forums ul,.widget_display_topics ul,.widget_display_stats dl,.widget_display_views ul,.widget_display_replies ul,#wp-calendar thead th,#wp-calendar thead td,.buddypress.widget .item-list li,.buddypress.widget .widget-error,.hdcn4 .brdcrm,.post-blg section ul li:before{color:'. gamexls_get_option( 'bd-general-c4', '#999' ).'}
- </style>
- '."\n\r";
- }
- if( gamexls_get_option( 'custom-css', '' ) !=''){echo'<style type="text/css">'.gamexls_get_option( 'custom-css', '' ).'</style>'."\n\r";}
- }
- add_action('wp_head', 'mt_custom_css');
- function mt_footer() {
- if( gamexls_get_option( 'custom_footer_code', '' ) !=''){echo stripslashes( gamexls_get_option( 'custom_footer_code', '' ) )."\r";}
- // Get the blog category
- $blog_category = gamexls_get_option( 'blogcat', '' );
- if(is_game() or is_single() or in_category($blog_category)){
- ?>
- <div id="fb-root"></div>
- <script>(function(d, s, id) {
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) return;
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_EN/all.js#xfbml=1&appId=483876481726854";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));</script>
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
- <script type="text/javascript">
- window.___gcfg = {lang: 'en'};
- (function() {
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
- po.src = 'https://apis.google.com/js/plusone.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
- })();
- </script>
- <?php
- }
- }
- add_action('wp_footer', 'mt_footer');
- function mt_get_excerpt($excerpt_length = false, $echo = true) {
- global $post;
- // Get post excerpt
- $text = strip_shortcodes( $post->post_content );
- $text = apply_filters('the_content', $text);
- $text = str_replace(']]>', ']]>', $text);
- $text = wp_trim_words( $text, 100, '' );
- if ( $excerpt_length ) {
- if ( strlen($text) > $excerpt_length ) {
- $text = mb_substr($text, 0, $excerpt_length).' [...]';
- }
- }
- if ($echo)
- echo $text;
- else
- return $text;
- }
- function mt_get_best_players( $count = 5 ) {
- global $wpdb;
- return $wpdb->get_results("SELECT h.user_id, COUNT(*) as highscores, u.plays as plays
- FROM ".MYARCADE_HIGHSCORES_TABLE." AS h
- INNER JOIN ".MYARCADE_USER_TABLE." AS u ON h.user_id=u.user_id
- GROUP BY h.user_id
- ORDER BY highscores DESC LIMIT ".$count);
- }
- function mt_get_excluded_categories() {
- $result = 'exclude=';
- $blog = gamexls_get_option( 'blogcat', '' );
- if ( $blog ) {
- $result = 'exclude='.$blog.',';
- }
- if ( !empty( gamexls_get_option( 'hidecatbox', '' )) ) {
- $categories = implode(',', gamexls_get_option( 'hidecatbox', '' ) );
- }
- else {
- $categories = '';
- }
- $result .= $categories;
- return $result;
- }
- function gamexls_before_boxes(){
- $option= gamexls_get_option( 'presentation', 'Complete' );
- if($option=='Miniclip'){
- echo'
- <!--<pstp-2>-->
- <ul class="pstp-2 lstpst flli clfl">
- ';
- }
- if($option=='Vertical'){
- echo'<!--<pstp-3>--><ul class="pstp-3 lstpst clfl flli">';
- }
- }
- add_action( 'gamexls_before_boxes', 'gamexls_before_boxes');
- function gamexls_after_boxes(){
- global $post;
- $option= gamexls_get_option( 'presentation', 'Complete' );
- if($option=='Half' or $option=='Miniclip' or $option=='Complete'){
- echo'</ul><!--</pstp-2>-->';
- }
- if($option=='Vertical'){
- echo'</ul><!--</pstp-3>-->';
- }
- if($option=='Complete'){
- ?>
- <?php if( gamexls_get_option( 'mtbeforelastestgames-switch', 1 ) =='1'){ ?>
- <!--<bnr728>-->
- <section class="blkcn bnr728 bgc1 mbot10px">
- <?php echo stripslashes( gamexls_get_option( 'mtbeforelastestgames', '<img src="'.get_template_directory_uri().'/img/cnt/bnr728.png" alt="bnr">' ) ); ?>
- </section>
- <!--</bnr728>-->
- <?php } ?>
- <!--<latest games>-->
- <section class="blkcn pstp-4 mbot10px">
- <div class="blkhd"><strong><?php _e('LATEST GAMES','gamexls'); ?></strong></div>
- <section class="blkbd lstlatgms clfl bgwh padd10px">
- <?php if( gamexls_get_option( 'mtlastestgames-switch', 1 ) =='1'){ ?>
- <!--<bnr250>-->
- <section class="blkcn bnr250 bgc1 mbot10px">
- <?php echo stripslashes( gamexls_get_option( 'mtlastestgames', '<img src="'.get_template_directory_uri().'/img/cnt/bnr250.png" alt="bnr">' ) ); ?>
- </section>
- <!--</bnr250>-->
- <?php } ?>
- <ul>
- <?php
- $query = new WP_Query('showposts=6'.gamexls_mobile_tag());
- while ($query->have_posts()) :
- $query->the_post();
- ?>
- <!--<game>-->
- <li>
- <article>
- <header>
- <h2><a href="<?php the_permalink(); ?>"><?php myabp_get_title(20); ?></a></h2>
- <figure class="imgame"><?php echo myabp_print_thumbnail(270,270); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Play <?php the_title(); ?>"><i class="iconb-game bgbl-20 rnd15"></i></a></figure>
- </header>
- <footer class="clfl">
- <?php if(function_exists('the_ratings')) { ?>
- <div class="votcnt">
- <?php echo mt_the_ratings_results($post->ID); ?>
- </div>
- <?php } ?>
- <div>
- <?php if(function_exists('the_views')) { ?><span class="iconb-game"><?php the_views(); ?></span><?php } ?> <strong class="iconb-comt"><?php echo get_comments_number(); ?></strong>
- </div>
- </footer>
- </article>
- </li>
- <!--</game>-->
- <?php
- endwhile;
- ?>
- </ul>
- </section>
- </section>
- <!--</latest games>-->
- <?php
- }
- }
- add_action( 'gamexls_after_boxes', 'gamexls_after_boxes');
- function gamexls_before_boxes_complete(){
- global $i;
- $option= gamexls_get_option( 'presentation', 'Complete' );
- if($option=='Complete' and $i==2){
- echo'<!--<pstp-2>--><ul class="pstp-2 lstpst clfl flli">';
- }
- }
- add_action( 'gamexls_before_boxes_complete', 'gamexls_before_boxes_complete');
- function gamexls_after_boxes_complete(){
- global $i;
- $option= gamexls_get_option( 'presentation', 'Complete' );
- if($option=='Complete' and $i==7){
- echo'</ul><!--</pstp-2>-->';
- }
- }
- add_action( 'gamexls_after_boxes_complete', 'gamexls_after_boxes_complete');
- function gamexls_before_boxes_complete_slider(){
- global $i;
- $option= gamexls_get_option( 'presentation', 'Complete' );
- if($option=='Complete' and $i==8){
- echo'<!--<pstp-3>--><ul class="pstp-3 lstpst clfl flli">';
- }
- }
- add_action( 'gamexls_before_boxes_complete_slider', 'gamexls_before_boxes_complete_slider');
- function mt_calculate_height($gamexls_box_count) {
- switch ( gamexls_get_option( 'presentation', 'Complete' ) ) {
- case 'Vertical': {
- $count = round(intval($gamexls_box_count) / 2);
- $height = 60 + 110 * $count;
- return 'style="height:'.$height.'px;"';
- } break;
- case 'Half': {
- $count = round(intval($gamexls_box_count) );
- if($count>=5){$height = 10 + 40 * $count;}elseif($count==1){$height = 10 + 80 * $count;}else{$height = 10 + 60 * $count;}
- return 'style="height:'.$height.'px;"';
- } break;
- case 'Miniclip': {
- $count = round(intval($gamexls_box_count) );
- if($count>=5){$height = 10 + 40 * $count;}elseif($count==1){$height = 10 + 80 * $count;}else{$height = 10 + 60 * $count;}
- return 'style="height:'.$height.'px;"';
- } break;
- case 'Complete': {
- $count = round(intval($gamexls_box_count) );
- if($count>=5){$height = 10 + 37 * $count;}elseif($count==1){$height = 10 + 80 * $count;}else{$height = 10 + 60 * $count;}
- return 'style="height:'.$height.'px;"';
- } break;
- default: {
- return false;
- }
- }
- return '';
- }
- function gamexls_content(){
- $content = apply_filters('the_content', get_the_content());
- $content = preg_replace("/<img[^>]+\>/i", "", $content);
- return $content;
- }
- function gamexls_comment( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- switch ( $comment->comment_type ) :
- case '' :
- ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
- <!--<comnt>-->
- <div class="comtcn pore" id="comment-<?php comment_ID(); ?>">
- <figure class="cirl-imgusrcn bgwh-10"><?php echo get_avatar( $comment, 116); ?></figure>
- <div class="txcmrnd10 bgc1 pore">
- <p><?php echo get_comment_author_link(); ?> - <?php echo get_comment_date('d'); ?>/<?php echo get_comment_date('m'); ?>/<?php echo get_comment_date('Y'); ?></p>
- <?php if ( $comment->comment_approved == '0' ) : ?>
- <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'gamexls' ); ?></em>
- <br />
- <?php endif; ?>
- <div class="comment_txt"><?php comment_text(); ?></div>
- <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
- </div>
- </div>
- <!--</comnt>-->
- <?php
- break;
- case 'pingback' :
- case 'trackback' :
- ?>
- <li class="post pingback">
- <p><?php _e( 'Pingback:', 'gamexls' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'gamexls' ), ' ' ); ?></p>
- <?php
- break;
- endswitch;
- }
- if(function_exists('the_ratings')) {
- function mt_the_ratings_results($post_id, $new_user = 0, $new_score = 0, $new_average = 0) {
- if($new_user == 0 && $new_score == 0 && $new_average == 0) {
- $post_ratings_data = null;
- } else {
- $post_ratings_data = new stdClass();
- $post_ratings_data->ratings_users = $new_user;
- $post_ratings_data->ratings_score = $new_score;
- $post_ratings_data->ratings_average = $new_average;
- }
- // Return Post Ratings Template
- return expand_ratings_template('%RATINGS_IMAGES%', $post_id, $post_ratings_data);
- }
- }
- add_action('init', 'gamexls_init', 0);
- // Add filter for blog template
- add_filter('category_template', 'gamexls_blogcat_template');
- if ( !function_exists('gamexls_blogcat_template') ) {
- /**
- * Blog template redirection
- */
- function gamexls_blogcat_template($template) {
- global $post;
- // Get the blog category
- $blog_category = gamexls_get_option( 'blogcat', '' );
- if ($blog_category == '') return $template;
- if(in_category($blog_category)){
- // overwrite the template file if exist
- if ( file_exists(get_template_directory() . '/template-blog.php' ) ) {
- $template = get_template_directory() . '/template-blog.php';
- }
- }
- return $template;
- }
- }
- // Add filter for blog template
- add_filter('single_template', 'gamexls_blog_template');
- if ( !function_exists('gamexls_blog_template') ) {
- /**
- * Blog template redirection
- */
- function gamexls_blog_template($template) {
- global $post;
- // Get the blog category
- $blog_category = gamexls_get_option( 'blogcat', '' );
- if ($blog_category == '') return $template;
- $post_cat = get_the_category();
- if ( is_singular() && !empty($post_cat) and (in_category($blog_category) || ($blog_category == $post_cat[0]->category_parent))) {
- // overwrite the template file if exist
- if ( file_exists(get_template_directory() . '/template-blog-post.php' ) ) {
- $template = get_template_directory() . '/template-blog-post.php';
- }
- }
- return $template;
- }
- }
- /**
- * GameXLS activation function
- */
- function gamexls_activation( $oldname, $oldtheme = false ) {
- add_rewrite_endpoint( 'play', EP_PERMALINK );
- add_rewrite_endpoint('fullscreen', EP_PERMALINK);
- flush_rewrite_rules();
- }
- add_action('after_switch_theme', 'gamexls_activation', 0);
- /**
- * GameXLS init function - called when WordPress is initialized
- */
- function gamexls_init() {
- // Check if pre-game page is enabled
- if ( gamexls_get_option( 'pregame-page', 1 ) == '1' ) {
- $endpoint = gamexls_get_option( 'game-play-permalink-endpoint', 'play' );
- if ( empty($endpoint) ) $endpoint = 'play';
- add_rewrite_endpoint( $endpoint, EP_PERMALINK );
- add_action( 'template_redirect', 'gamexls_play_template_redirect' );
- }
- // Check if fullscreen option is enabled
- if ( gamexls_get_option( 'fullscreen-button', 1 ) == '1' ) {
- add_rewrite_endpoint('fullscreen', EP_PERMALINK);
- add_action('template_redirect', 'gamexls_fullscreen_teplate_redirect');
- }
- }
- /**
- * Handles game display when user comes from the pre-game page (game landing page)
- *
- * @global type $wp_query
- * @return type
- */
- function gamexls_play_template_redirect() {
- global $wp_query;
- $endpoint = gamexls_get_option( 'game-play-permalink-endpoint', 'play' );
- if ( empty($endpoint) ) return;
- // if this is not a request for game play then bail
- if ( !is_singular() || !isset($wp_query->query_vars[$endpoint]) ) {
- return;
- }
- // Include game play template
- include dirname( __FILE__ ) . '/single-play.php';
- exit;
- }
- /**
- * Handles full screen redirect
- *
- * @global type $wp_query
- * @return type
- */
- function gamexls_fullscreen_teplate_redirect() {
- global $wp_query;
- // if this is not a fullscreen request then bail
- if ( !is_singular() || !isset($wp_query->query_vars['fullscreen']) ) {
- return;
- }
- // Include fullscreen template
- include dirname( __FILE__ ) . '/single-fullscreen.php';
- exit;
- }
- /**
- * Generate play permalink
- *
- * @return type
- */
- function gamexls_play_link($op=1) {
- $endpoint = gamexls_get_option( 'game-play-permalink-endpoint', 'play' );
- if ( empty($endpoint) ) return;
- if($op==1){
- ?>
- <a href="<?php echo get_permalink() . $endpoint . '/'; ?>" title="<?php echo __("Play the game", "gamexls"); ?> <?php the_title_attribute(); ?>" rel="bookmark nofollow" class="botn iconb-game"><?php _e("Play The Game", "gamexls"); ?></a>
- <?php
- }else{
- ?>
- <a href="<?php echo get_permalink() . $endpoint . '/'; ?>" title="<?php echo __("Play The Game", "gamexls"); ?> <?php the_title_attribute(); ?>" rel="bookmark nofollow"><i class="iconb-game bgbl-20 rnd15"></i></a>
- <?php
- }
- }
- class gamexls_walker_nav_menu extends Walker_Nav_Menu {
- // add classes to ul sub-menus
- function start_lvl( &$output, $depth = 0, $args = array() ) {
- // depth dependent classes
- $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
- $display_depth = ( $depth + 1); // because it counts the first submenu as 0
- $classes = array(
- 'sub-menu',
- ( $display_depth % 2 ? 'menu-odd' : 'menu-even' ),
- ( $display_depth >=2 ? 'sub-sub-menu' : '' ),
- 'menu-depth-' . $display_depth
- );
- $class_names = implode( ' ', $classes );
- // build html
- $output .= "\n" . $indent . '<ul class="' . $class_names . '">' . "\n";
- }
- // add main/sub classes to li's and links
- function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
- global $wp_query;
- $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
- // depth dependent classes
- $depth_classes = array(
- ( $depth == 0 ? 'main-menu-item' : 'sub-menu-item' ),
- ( $depth >=2 ? 'sub-sub-menu-item' : '' ),
- ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ),
- 'menu-item-depth-' . $depth
- );
- $depth_class_names = esc_attr( implode( ' ', $depth_classes ) );
- // passed classes
- $classes = empty( $item->classes ) ? array() : (array) $item->classes;
- $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) );
- // build html
- $output .= $indent . '<li id="nav-menu-item-'. $item->ID . '" class="' . $depth_class_names . ' ' . $class_names . '">';
- // link attributes
- $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
- $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
- $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
- $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
- $attributes .= ' class="menu-link ' . ( $depth > 0 ? 'sub-menu-link' : 'main-menu-link' ) . '"';
- $item_output = sprintf( '%1$s<a%2$s>%3$s%4$s%5$s</a>%6$s',
- $args->before,
- $attributes,
- $args->link_before,
- apply_filters( 'the_title', $item->title, $item->ID ),
- $args->link_after,
- $args->after
- );
- // build html
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- }
- /**
- * Display Google Rich Snippet
- *
- * @global type $post
- */
- function gamexls_rich_snippet() {
- global $post;
- if ( function_exists('the_ratings') && gamexls_get_option( 'rich-snippet', 1 ) == '1' ) {
- $ratings_user = intval(get_post_meta($post->ID, 'ratings_users', true));
- $rating_average = get_post_meta($post->ID, 'ratings_average', true);
- $ratings_max = intval(get_option('postratings_max'));
- if ( empty($rating_average) ) $rating_average = 0;
- echo "\n";
- ?>
- <!-- Google Rich Snipet -->
- <div itemscope itemtype="http://schema.org/SoftwareApplication">
- <meta itemprop="name" content="<?php the_title(); ?>" />
- <meta itemprop="image" content="<?php myabp_print_thumbnail_url(); ?>" />
- <meta itemprop="description" content="<?php echo get_the_excerpt(); ?>" />
- <meta itemprop="softwareApplicationCategory" content="GameApplication" />
- <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
- <span itemprop="ratingCount"><?php echo $ratings_user; ?></span> <?php _e('votes','gamexls'); ?>, <?php _e('average:','gamexls'); ?> <span itemprop="ratingValue"><?php echo $rating_average; ?></span>/<span itemprop="bestRating"><?php echo $ratings_max; ?></span>
- </div>
- </div>
- <?php
- echo "\n";
- }
- }
- add_action('widgets_init', 'mt_widgets_init');
- function mt_widgets_init() {
- register_sidebar(
- array('name' =>'Home Sidebar',
- 'id' =>'home-sidebar',
- 'description' => __('This is the sidebar that gets shown on the home page.','gamexls'),
- 'before_widget' => '<section id="%1$s" class="blkcn mbot10px %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<div class="blkhd">',
- 'after_title' => '</div>',
- )
- );
- register_sidebar(
- array('name' =>'Single Sidebar',
- 'id' =>'single-sidebar',
- 'description' => __('This is your sidebar that gets shown on the game or blog pages.','gamexls'),
- 'before_widget' => '<section id="%1$s" class="blkcn mbot10px %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<div class="blkhd">',
- 'after_title' => '</div>',
- )
- );
- register_sidebar(
- array('name' =>'Page Sidebar',
- 'id' =>'page-sidebar',
- 'description' => __('This is your sidebar that gets shown on most of your pages.','gamexls'),
- 'before_widget' => '<section id="%1$s" class="blkcn mbot10px %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<div class="blkhd">',
- 'after_title' => '</div>',
- )
- );
- register_sidebar(
- array('name' =>'Category Sidebar',
- 'id' =>'category-sidebar',
- 'description' => __('This is your sidebar that gets shown on the category pages.','gamexls'),
- 'before_widget' => '<section id="%1$s" class="blkcn mbot10px %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<div class="blkhd">',
- 'after_title' => '</div>',
- )
- );
- }
- function bp_core_register_common_scripts_gamexls() {
- if ( gamexls_get_option( 'bp-compatibility', 1 ) == '1' ) {
- $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
- $url = buddypress()->plugin_url . 'bp-core/js/';
- $scripts = apply_filters( 'bp_core_register_common_scripts', array(
- // Legacy
- 'bp-confirm' => array( 'file' => "{$url}confirm{$min}.js", 'dependencies' => array( 'jquery' ) ),
- 'bp-widget-members' => array( 'file' => "{$url}widget-members{$min}.js", 'dependencies' => array( 'jquery' ) ),
- 'bp-jquery-query' => array( 'file' => "{$url}jquery-query{$min}.js", 'dependencies' => array( 'jquery' ) ),
- 'bp-jquery-cookie' => array( 'file' => "{$url}jquery-cookie{$min}.js", 'dependencies' => array( 'jquery' ) ),
- // 2.1
- 'jquery-caret' => array( 'file' => "{$url}jquery.caret{$min}.js", 'dependencies' => array( 'jquery' ) ),
- 'jquery-atwho' => array( 'file' => "{$url}jquery.atwho{$min}.js", 'dependencies' => array( 'jquery', 'jquery-caret' ) ),
- ) );
- $version = bp_get_version();
- foreach ( $scripts as $id => $script ) {
- wp_register_script( $id, $script['file'], $script['dependencies'], $version );
- wp_enqueue_script( $id );
- }
- }
- }
- add_action( 'bp_enqueue_scripts', 'bp_core_register_common_scripts_gamexls', 1 );
- /**
- * Remove query strings from static resources
- *
- * @version 1.0.0
- * @since 1.0.0
- * @return string Cleaned script URL
- */
- function gamexls_script_version( $src ){
- $parts = explode( '?ver', $src );
- return $parts[0];
- }
- if ( ! is_admin() ) {
- add_filter( 'script_loader_src', 'gamexls_script_version', 15, 1 );
- add_filter( 'style_loader_src', 'gamexls_script_version', 15, 1 );
- }
- /**
- * Get mobile query tag is the site is access by a mobile device
- *
- * @version 1.0.0
- * @since 1.0.0
- * @return [type] [description]
- */
- function gamexls_mobile_tag() {
- if ( wp_is_mobile() && gamexls_get_option( 'mobile' ) ) {
- return '&tag=mobile';
- }
- return false;
- }
- /**
- * Get mobile query array tag is the site is access by a mobile device
- *
- * @version 1.0.0
- * @since 1.0.0
- * @return [type] [description]
- */
- function gamexls_mobile_array_tag() {
- if ( wp_is_mobile() && gamexls_get_option( 'mobile' ) ) {
- return 'mobile';
- }
- return false;
- }
- /**
- * Retrieve a theme option
- *
- * @version 2.0.0
- * @since 2.0.0
- * @param string $option_name
- * @return mixed
- */
- function gamexls_get_option( $option_name, $default = false ) {
- global $gamexlsmt;
- if ( empty( $gamexlsmt ) ) {
- $gamexlsmt = get_option( 'gamexlsmt' );
- }
- if ( ! isset( $gamexlsmt[ $option_name ] ) ) {
- return $default;
- }
- return $gamexlsmt[ $option_name ];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement