Few fixes and improvements

parent 7151a9e9
......@@ -67,28 +67,82 @@ div.etn-single-event-media img.wp-post-image {
margin-left: 0px;
}
li.sh_signupmenu a {
.site-header-shmlogin > li.shmlogin > div {
display: inline;
margin-right: 10px;
}
.site-header-shmlogin {
list-style-type:none;
margin-left:0px;
padding:0px;
margin-bottom:0px;
width:21.7391304348%;
float:right !important;
position:relative;
}
.site-header-shmlogin > li.shmlogin > a, .site-header-shmlogin > li.shmlogin > div {
border:1px solid white;
padding-left:10px;
padding-right:10px;
border-top-left-radius:10px;
border-top-right-radius:10px;
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
}
.site-header-shmlogin:hover > li.shmlogin > a {
color:#d8d8d8;
}
.site-header-shmlogin > li.shmlogin > a:hover, .site-header-shmlogin > li.shmlogin > div > a:hover {
color:#ffffff;
}
.sh_loginbutton:hover .sh_loginpopup, .sh_loginpopup:hover, .sh_loginbutton:active .sh_loginpopup, .sh_loginpopup:focus-within {
display:block;
}
.sh_loginbutton:hover {
background-color:#111111;
}
.sh_loginpopup {
display: none;
background-color: #000000;
position: absolute;
padding: 10px;
z-index: 999;
margin-top:-4px;
border: grey 1px solid;
}
li.sh_signupmenu a, li a.sh_signupmenu {
background-color: #801939;
border-radius: 20px 20px 20px 20px;
}
li.sh_signupmenu a:after {
li.sh_signupmenu a:after, li a.sh_signupmenu:after {
content: " Free!";
background-color: yellow;
color: red;
font-weight: bold;
font-size: 0.7em;
padding: 2px;
margin-left: 6px;
border-radius: 10px;
}
li.sh_freememberacc a {
li.sh_freememberacc a, li a.sh_freememberacc {
background-color: #801939;
border-radius: 20px 20px 20px 20px;
}
li.sh_freememberacc a:after {
content: " Subscribe!";
li.sh_freememberacc a:after, li a.sh_freememberacc:after {
content: " Upgrade!";
background-color: yellow;
color: red;
font-weight: bold;
......@@ -143,7 +197,7 @@ li.current_page_item {
.site-header-cart .cart-contents {
padding: 1px;
padding-top: 10px;
padding-top: 1px;
}
.page h1.entry-title {
......@@ -228,6 +282,14 @@ li.current_page_item {
padding-top: 0.2em;
padding-bottom: 0.2em;
}
.site-header-shmlogin {
display:none;
}
.site-branding {
width:calc(100% - 150px);
}
button.menu-toggle {
padding-top: 35px;
border-radius: 8px 8px 8px 8px;
......@@ -236,8 +298,8 @@ li.current_page_item {
}
.handheld-navigation ul.menu li {
font-size: 1.5em;
line-height: 0.3em;
font-size: 1.2em;
line-height: 1.0em;
}
li.sh_signupmenu a {
......
......@@ -161,7 +161,7 @@ if(!class_exists('SH_Shortcodes')) {
foreach($videos as $video)
{
if(in_array(strval($vcount), $adv)) // && !user_is_premium() && $advid && is_numeric($advid) && intval($advid)>0)
if(in_array(strval($vcount), $adv) && is_numeric($advid) && intval($advid) >= 0) // && !user_is_premium() && $advid && is_numeric($advid) && intval($advid)>0)
{
$html .= '<li class="product type-product sexhack_thumbli">';
$html .= do_shortcode("[sexadv adv=$advid]");
......@@ -226,9 +226,21 @@ if(!class_exists('SH_Shortcodes')) {
if(!array_key_exists('level', $attr)) $attr['level'] = 'public';
if(($attr['level'] == 'guestonly' && !is_user_logged_in()) || ($attr['level'] == 'public' or !$attr['level']) || (is_user_logged_in() && ($attr['level']=='members' || ($attr['level']=='premium' && user_is_premium()))))
{
if(is_numeric($attr['page'])) {
$ipost = get_post($attr['page']);
if($ipost) {
return $ipost->post_content;
if($ipost)
return apply_filters('the_content', $ipost->post_content);
} else {
$args = array(
'name' => $attr['page'],
'post_type' => 'page',
'post_status' => 'publish',
'posts_per_page' => 1
);
$res = get_posts($args);
if($res) {
return apply_filters('the_content', $res[0]->post_content);
}
}
}
return;
......
......@@ -50,9 +50,12 @@ if(!class_exists('SH_StoreFront')) {
register_nav_menu('shm-footer-menu',__( 'Sexhackme Footer Menu' ));
add_action( 'storefront_footer', 'wp_SexHackMe\SH_StoreFront::footer_menu', 15);
// Add menu location for card widget
register_nav_menu( 'shm-cartmenu', __( 'Cart widget Menu' ));
// Re add the cart in the right position
add_action( 'storefront_header', 'storefront_header_cart', 40);
//add_action( 'storefront_header', 'storefront_header_cart', 40);
add_action( 'storefront_header', 'wp_SexHackMe\SH_StoreFront::sexhackme_header_cart', 40);
// Remove breadcrumb
remove_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10 );
......@@ -61,7 +64,9 @@ if(!class_exists('SH_StoreFront')) {
add_filter( 'storefront_menu_toggle_text', 'wp_SexHackMe\SH_StoreFront::storefront_menu_toggle_text' );
// Add account button to handheld menu
add_action( 'storefront_header', 'wp_SexHackMe\SH_StoreFront::add_handheld_account', 49); // storefront uses 50 priority for primary_navigation
add_action( 'storefront_header', 'wp_SexHackMe\SH_StoreFront::add_handheld_account', 48); // storefront uses 50 priority for primary_navigation
add_action( 'storefront_header', 'wp_SexHackMe\SH_StoreFront::add_handheld_cart', 49);
// Replace 404 page if /404.php exists
if (is_readable($_SERVER['DOCUMENT_ROOT'].'/404.php')) {
......@@ -79,13 +84,75 @@ if(!class_exists('SH_StoreFront')) {
}
}
// Sobstitute the function storefront_header_cart()
public static function sexhackme_header_cart()
{
//storefront_header_cart();
//echo "<ul><li/>antani</li></ul>";
if ( storefront_is_woocommerce_activated() ) {
if ( is_cart() ) {
$class = 'current-menu-item';
} else {
$class = '';
}
?>
<ul class="site-header-shmlogin menu">
<li class="shmlogin">
<?php
if(!is_user_logged_in()) {
?>
<div class="sh_loginbutton">
<a href="/login">Login</a>
<div class="sh_loginpopup">
<?php
echo do_shortcode('[shincludepage page="login"]' );
?>
</div>
</div>
<a class="sh_signupmenu" href="/register">Signup</a>
<?php
} else if(is_user_logged_in() && !user_is_premium()) {
?>
<a href="/account/">My Account</a>
<a class="sh_freememberacc" href="/product-category/subscriptions/">Premium</a>
<?php
} else if(is_user_logged_in() && user_is_premium()) {
?>
<a href="/account/">My Account</a>
<?php
}
?>
<i class="fa fa-user " style="position:relative;display:block;float:right;color:white;" aria-hidden="true"></i>
</li>
</ul>
<ul id="site-header-cart" class="site-header-cart menu">
<li class="<?php echo esc_attr( $class ); ?>">
<?php storefront_cart_link(); ?>
</li>
<li>
<?php the_widget( 'WC_Widget_Cart', 'title=' ); ?>
</li>
</ul>
<?php
}
}
public static function add_handheld_account()
{
// XXX set an option for the account and login page?
if(is_user_logged_in()) $url="/account";
else $url="/login";
?>
<a href="<?php echo $url; ?>"><i class="fa fa-user fa-3x" style="position:relative;display:block;float:left;color:white;" aria-hidden="true"></i></a>
<a href="<?php echo $url; ?>"><i class="fa fa-user fa-2x" style="margin-left:10px;position:relative;display:block;float:left;color:white;" aria-hidden="true"></i></a>
<?php
}
public static function add_handheld_cart()
{
// XXX set an option for the account and login page?
$url=WC()->cart->get_cart_url();
?>
<a href="<?php echo $url; ?>"><i class="fa fa-shopping-cart fa-2x" style="margin-left:10px;position:relative;display:block;float:left;color:white;" aria-hidden="true"></i></a>
<?php
}
......
......@@ -649,12 +649,15 @@ if(!class_exists('SH_WooCommerce_Chaturbate_Payments')) {
public function usd2tokens($usd) {
$tot = $usd/$this->cb_change;
$rem = $usr % $this->cb_change;
//$rem = fmod($usd, $this->cb_change);
bcscale(2);
$rem = bcmod($usd, $this->cb_change);
if($rem > 0) $tot=$tot+1;
return $tot;
}
public function webhook_cb() {
header( 'HTTP/1.1 200 OK' );
if($_GET['key'] == $this->api_passkey) {
$msg=$_GET['msg'];
$tkns=intval($_GET['tkns']);
......@@ -662,11 +665,14 @@ if(!class_exists('SH_WooCommerce_Chaturbate_Payments')) {
$order_id = intval(str_replace($this->uuid_prefix, '', $msg));
$order = wc_get_order( $order_id );
$tktotal = $this->usd2tokens($order->get_total());
echo "$tktotal $tkns ".$order->get_total();
if($tkns >= $tktotal) {
$order->payment_complete();
echo "OK";
}
}
}
die();
//$order->reduce_order_stock();
}
......@@ -742,7 +748,7 @@ if(!class_exists('SH_WooCommerce_Chaturbate_Payments')) {
$order = wc_get_order( $order_id );
$totalusd = $order->get_total();
}
$instr = str_replace('{TOTAL}', intval($this->usd2tokens($totalusd), $instr);
$instr = str_replace('{TOTAL}', intval($this->usd2tokens($totalusd)), $instr);
return $instr;
}
......@@ -783,7 +789,7 @@ if(!class_exists('SH_WooCommerce_Chaturbate_Payments')) {
// Mark as on-hold (we're awaiting the shchaturbate).
$order->update_status(
apply_filters( 'woocommerce_shchaturbate_process_payment_order_status', 'on-hold', $order ),
'Waiting for '.intval($this->usd2tokens($total).' tokens to https://chaturbate.com/'.$this->cb_model.' with message '.$this->uuid_prefix.$order_id
'Waiting for '.intval($this->usd2tokens($total)).' tokens to https://chaturbate.com/'.$this->cb_model.' with message '.$this->uuid_prefix.$order_id
);
} else {
$order->payment_complete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment