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
7ac1cb62
Commit
7ac1cb62
authored
Jul 14, 2022
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved WooCommerce email only checkout fixes
parent
177b9e8c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
395 deletions
+33
-395
add_unlock_login.php
deprecated/add_unlock_login.php
+0
-125
woocommerce_email_checkout.php
deprecated/woocommerce_email_checkout.php
+0
-103
woocommerce_product_videos.php
deprecated/woocommerce_product_videos.php
+0
-100
woocommerce_remove_namesurname.php
deprecated/woocommerce_remove_namesurname.php
+0
-67
functions-utils.php
includes/functions-utils.php
+25
-0
sexhackme.php
sexhackme.php
+8
-0
No files found.
deprecated/add_unlock_login.php
deleted
100644 → 0
View file @
177b9e8c
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin 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.
*
* SexHackMe Wordpress Plugin 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.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
if
(
!
class_exists
(
'SexhackAddUnlockLogin'
))
{
class
SexhackAddUnlockLogin
{
public
function
__construct
()
{
add_filter
(
"login_form_bottom"
,
array
(
$this
,
"add_to_login"
),
10
,
2
);
add_action
(
"woocommerce_after_order_notes"
,
array
(
$this
,
"add_to_checkout"
));
add_filter
(
"pms_register_shortcode_content"
,
array
(
$this
,
"add_to_register"
),
10
,
2
);
add_filter
(
"unlock_authenticate_user"
,
array
(
$this
,
"fix_unlock_user"
),
11
,
1
);
sexhack_log
(
'SexhackAddUnlockLogin() Instanced'
);
}
public
function
get_proto
(){
return
get_proto
();
}
public
function
fix_unlock_user
(
$user
)
{
global
$sexhack_pms
;
if
(
is_object
(
$user
)
&&
is_valid_eth_address
(
$user
->
user_login
))
{
if
(
!
(
$sexhack_pms
->
is_member
(
$user
->
ID
))
&&
!
(
$sexhack_pms
->
is_premium
(
$user
->
ID
)))
{
$subscription_plan
=
$sexhack_pms
->
get_default_plan
();
if
(
$subscription_plan
)
{
$data
=
array
(
'user_id'
=>
$user
->
ID
,
'subscription_plan_id'
=>
$subscription_plan
->
id
,
'start_date'
=>
date
(
'Y-m-d H:i:s'
),
'expiration_date'
=>
$subscription_plan
->
get_expiration_date
(),
'status'
=>
'active'
,
);
$member_subscription
=
new
\PMS_Member_Subscription
();
$inserted
=
$member_subscription
->
insert
(
$data
);
}
}
}
return
$user
;
}
public
function
unlock_get_login_url
(
$redirect_url
=
false
)
{
$UNLOCK_BASE_URL
=
'https://app.unlock-protocol.com/checkout'
;
$rurl
=
apply_filters
(
'unlock_protocol_get_redirect_uri'
,
wp_login_url
());
if
(
$redirect_url
)
{
$rurl
=
$redirect_url
;
}
$login_url
=
add_query_arg
(
array
(
'client_id'
=>
apply_filters
(
'unlock_protocol_get_client_id'
,
wp_parse_url
(
home_url
(),
PHP_URL_HOST
)
),
'redirect_uri'
=>
$rurl
,
'state'
=>
wp_create_nonce
(
'unlock_login_state'
),
),
$UNLOCK_BASE_URL
);
return
apply_filters
(
'unlock_protocol_get_login_url'
,
$login_url
);
}
public
function
unlock_button
(
$string
,
$args
,
$redirect_url
)
{
$html
=
""
;
if
(
!
is_user_logged_in
())
{
$html
=
"<hr><div style='text-align: center; width:100%;'><p>OR</p></div><hr>"
;
$html
.=
"<br><div style='text-align:left;width:100%;'<p><button onclick=
\"
window.location.href='"
.
$this
->
unlock_get_login_url
(
$redirect_url
);
$html
.=
"'
\"
type='button'>Login with Crypto Wallet</button></p></div>"
;
}
return
$string
.
$html
;
}
// XXX Those 3 functions, hard-coded uri's that are dependent on a shortcode? that's sounds a bad idea, we
// really need to implement the admin subpages for the plugin so i can setup easily more things!
public
function
add_to_register
(
$string
,
$args
){
return
$this
->
unlock_button
(
$string
,
$args
,
$this
->
get_proto
()
.
wp_parse_url
(
home_url
(),
PHP_URL_HOST
)
.
"/register"
);
}
public
function
add_to_login
(
$string
,
$args
){
return
$this
->
unlock_button
(
$string
,
$args
,
$this
->
get_proto
()
.
wp_parse_url
(
home_url
(),
PHP_URL_HOST
));
}
public
function
add_to_checkout
(){
echo
$this
->
unlock_button
(
''
,
$args
,
$this
->
get_proto
()
.
wp_parse_url
(
home_url
(),
PHP_URL_HOST
)
.
"/checkout"
);
}
}
}
$SEXHACK_SECTION
=
array
(
'class'
=>
'SexhackAddUnlockLogin'
,
'description'
=>
'Integrate Unlock login in PMS login and registration page, as well as woocommerce checkout page'
,
'name'
=>
'sexhackme_addunlockbutton'
);
?>
deprecated/woocommerce_email_checkout.php
deleted
100644 → 0
View file @
177b9e8c
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin 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.
*
* SexHackMe Wordpress Plugin 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.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
if
(
!
class_exists
(
'WoocommerceEmailCheckout'
))
{
class
WoocommerceEmailCheckout
{
public
function
__construct
()
{
sexhack_log
(
'WoocommerceEmailCheckout() Instanced'
);
add_filter
(
'woocommerce_checkout_fields'
,
array
(
$this
,
'simplify_checkout_virtual'
)
);
add_filter
(
'woocommerce_login_redirect'
,
array
(
$this
,
'fix_woocommerce_user'
),
99
,
2
);
}
public
function
simplify_checkout_virtual
(
$fields
)
{
$only_virtual
=
true
;
foreach
(
WC
()
->
cart
->
get_cart
()
as
$cart_item_key
=>
$cart_item
)
{
// Check if there are non-virtual products
if
(
!
$cart_item
[
'data'
]
->
is_virtual
()
)
$only_virtual
=
false
;
}
if
(
$only_virtual
)
{
unset
(
$fields
[
'billing'
][
'billing_company'
]);
unset
(
$fields
[
'billing'
][
'billing_address_1'
]);
unset
(
$fields
[
'billing'
][
'billing_address_2'
]);
unset
(
$fields
[
'billing'
][
'billing_city'
]);
unset
(
$fields
[
'billing'
][
'billing_postcode'
]);
unset
(
$fields
[
'billing'
][
'billing_country'
]);
unset
(
$fields
[
'billing'
][
'billing_state'
]);
unset
(
$fields
[
'billing'
][
'billing_phone'
]);
unset
(
$fields
[
'billing'
][
'billing_first_name'
]);
unset
(
$fields
[
'billing'
][
'billing_last_name'
]);
add_filter
(
'woocommerce_enable_order_notes_field'
,
'__return_false'
);
}
return
$fields
;
}
public
function
fix_woocommerce_user
(
$redirect
,
$user
)
{
global
$sexhack_pms
;
if
(
is_object
(
$user
)
&&
is_checkout
())
{
if
(
!
(
$sexhack_pms
->
is_member
(
$user
->
ID
))
&&
!
(
$sexhack_pms
->
is_premium
(
$user
->
ID
)))
{
$subscription_plan
=
$sexhack_pms
->
get_default_plan
();
if
(
$subscription_plan
)
{
$data
=
array
(
'user_id'
=>
$user
->
ID
,
'subscription_plan_id'
=>
$subscription_plan
->
id
,
'start_date'
=>
date
(
'Y-m-d H:i:s'
),
'expiration_date'
=>
$subscription_plan
->
get_expiration_date
(),
'status'
=>
'active'
,
);
$member_subscription
=
new
\PMS_Member_Subscription
();
$inserted
=
$member_subscription
->
insert
(
$data
);
}
}
}
return
$redirect
;
}
}
}
$SEXHACK_SECTION
=
array
(
'class'
=>
'WoocommerceEmailCheckout'
,
'description'
=>
'Reduce new user form on woocommerce checkout to email only for virtual/downloadable products'
,
'name'
=>
'sexhackme_woovirtcheckout'
);
?>
deprecated/woocommerce_product_videos.php
deleted
100644 → 0
View file @
177b9e8c
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin 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.
*
* SexHackMe Wordpress Plugin 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.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
if
(
!
class_exists
(
'SexhackWoocommerceProductVideos'
))
{
class
SexhackWoocommerceProductVideos
{
public
function
__construct
()
{
sexhack_log
(
'SexhackWoocommerceProductVideos() Instanced'
);
add_action
(
'woocommerce_before_single_product'
,
array
(
$this
,
'video_remove_default_woocommerce_image'
));
add_filter
(
'query_vars'
,
array
(
$this
,
'themeslug_query_vars'
));
}
public
function
themeslug_query_vars
(
$qvars
)
{
$qvars
[]
=
'sexhack_forcevideo'
;
return
$qvars
;
}
public
function
video_remove_default_woocommerce_image
()
{
remove_action
(
'woocommerce_before_single_product_summary'
,
'woocommerce_show_product_images'
,
20
);
remove_action
(
'woocommerce_product_thumbnails'
,
'woocommerce_show_product_thumbnails'
,
20
);
add_action
(
'woocommerce_before_single_product_summary'
,
array
(
$this
,
'woocommerce_show_product_images_videos'
),
30
);
}
public
function
woocommerce_show_product_images_videos
()
{
// Get video and display
$prod
=
wc_get_product
(
get_the_ID
());
// verify GET vars
$bypass
=
get_query_var
(
'sexhack_forcevideo'
,
false
);
// Possible displays
$disps
=
array
(
'video'
,
'gif'
,
'image'
);
// By default fallback to:
$display
=
'image'
;
// detect attributes
$video
=
$prod
->
get_attribute
(
'video_preview'
);
$gif
=
$prod
->
get_attribute
(
'gif_preview'
);
if
(
in_array
(
$bypass
,
$disps
))
$display
=
$bypass
;
else
if
(
$video
)
$display
=
"video"
;
else
if
(
$gif
)
$display
=
"gif"
;
switch
(
$display
)
{
case
"video"
:
// Sanitize video URL
$video
=
esc_url
(
$video
);
// Display video
echo
'<div class="images"><div class="responsive-video-wrap"><h3>Video Preview</h3>'
;
echo
'<video src='
.
"'
$video
'"
.
' controls autoplay muted playsinline loop></video></div></div>'
;
break
;
case
"gif"
:
// sanitize URL
$gif
=
esc_url
(
$gif
);
// Display GIF
echo
'<div class="images"><img src="'
.
$gif
.
'" /></div>'
;
break
;
case
"image"
:
// No video defined so get thumbnail
wc_get_template
(
'single-product/product-image.php'
);
break
;
}
}
}
}
$SEXHACK_SECTION
=
array
(
'class'
=>
'SexhackWoocommerceProductVideos'
,
'description'
=>
'Video in Products for woocommerce'
,
'name'
=>
'sexhackme_video'
);
?>
deprecated/woocommerce_remove_namesurname.php
deleted
100644 → 0
View file @
177b9e8c
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin 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.
*
* SexHackMe Wordpress Plugin 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.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace
wp_SexHackMe
;
if
(
!
class_exists
(
'WoocommerceAccountRemoveNameSurname'
))
{
class
WoocommerceAccountRemoveNameSurname
{
public
function
__construct
()
{
add_filter
(
'woocommerce_save_account_details_required_fields'
,
array
(
$this
,
'ts_hide_first_last_name'
));
add_action
(
'woocommerce_edit_account_form_start'
,
array
(
$this
,
'add_username_to_edit_account_form'
));
sexhack_log
(
'WoocommerceAccountRemoveNameSurname() Instanced'
);
}
// Add the custom field "username"
public
function
add_username_to_edit_account_form
()
{
$user
=
wp_get_current_user
();
?>
<p
class=
"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"
>
<label
for=
"username"
>
<?php
_e
(
'Username'
,
'woocommerce'
);
?>
(Cannot be changed!)
</label>
<input
type=
"text"
class=
"woocommerce-Input woocommerce-Input--text input-text"
name=
"username"
id=
"username"
value=
"
<?php
echo
esc_attr
(
$user
->
user_login
);
?>
"
disabled
/>
</p>
<?php
}
public
function
ts_hide_first_last_name
(
$required_fields
)
{
unset
(
$required_fields
[
"account_first_name"
]);
unset
(
$required_fields
[
"account_last_name"
]);
unset
(
$required_fields
[
"account_display_name"
]);
return
$required_fields
;
}
}
}
$SEXHACK_SECTION
=
array
(
'class'
=>
'WoocommerceAccountRemoveNameSurname'
,
'description'
=>
'Remove Name and Surname fields from the woocommerce account details page'
,
'name'
=>
'sexhackme_woonamesurname'
);
?>
includes/functions-utils.php
View file @
7ac1cb62
...
...
@@ -63,6 +63,31 @@ function sh_xr_player($video_url, $posters='', $projection='180_LR')
echo
SH_VideoPlayer
::
addPlayer
(
'xr'
,
$video_url
,
$posters
,
$projection
);
}
function
sh_fix_user_with_no_plan
(
$userid
)
{
global
$sexhack_pms
;
if
(
!
(
$sexhack_pms
->
is_member
(
$user
->
ID
))
&&
!
(
$sexhack_pms
->
is_premium
(
$user
->
ID
)))
{
$subscription_plan
=
$sexhack_pms
->
get_default_plan
();
if
(
$subscription_plan
)
{
$data
=
array
(
'user_id'
=>
$userid
,
'subscription_plan_id'
=>
$subscription_plan
->
id
,
'start_date'
=>
date
(
'Y-m-d H:i:s'
),
'expiration_date'
=>
$subscription_plan
->
get_expiration_date
(),
'status'
=>
'active'
,
);
$member_subscription
=
new
\PMS_Member_Subscription
();
$inserted
=
$member_subscription
->
insert
(
$data
);
}
}
}
function
debug_rewrite_rules
(
$matchonly
=
false
)
{
$matchonly
=
true
;
...
...
sexhackme.php
View file @
7ac1cb62
...
...
@@ -229,10 +229,18 @@ if(!class_exists('SexHackMe_Plugin')) {
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/class-livecam-site-support.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/class-livecam-site-support.php'
;
/* WooCommerce support class */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/class-woocommerce-support.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/class-woocommerce-support.php'
;
/* Storefront customization support */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/class-storefront.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/class-storefront.php'
;
/* Unlock integration class */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/class-unlock-support.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/class-unlock-support.php'
;
/* Shortcodes */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/class-shortcodes.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/class-shortcodes.php'
;
...
...
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