Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
WordPress_SexHackMe_Plugin
Project
Project
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
SexHackMe
WordPress_SexHackMe_Plugin
Commits
59e0f5e2
Commit
59e0f5e2
authored
Aug 02, 2024
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Few fixes and improvements
parent
7151a9e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
19 deletions
+166
-19
sexhackme_header.css
css/sexhackme_header.css
+70
-8
class-shortcodes.php
includes/class-shortcodes.php
+17
-5
class-storefront.php
includes/class-storefront.php
+70
-3
class-woocommerce-support.php
includes/class-woocommerce-support.php
+9
-3
No files found.
css/sexhackme_header.css
View file @
59e0f5e2
...
...
@@ -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
:
"
Subscrib
e!"
;
li
.sh_freememberacc
a
:after
,
li
a
.sh_freememberacc
:after
{
content
:
"
Upgrad
e!"
;
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
:
1
0
px
;
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.
5
em
;
line-height
:
0.3
em
;
font-size
:
1.
2
em
;
line-height
:
1.0
em
;
}
li
.sh_signupmenu
a
{
...
...
includes/class-shortcodes.php
View file @
59e0f5e2
...
...
@@ -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
;
...
...
includes/class-storefront.php
View file @
59e0f5e2
...
...
@@ -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
}
...
...
includes/class-woocommerce-support.php
View file @
59e0f5e2
...
...
@@ -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
();
...
...
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