This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('WOOSL/API/get_downloadable_product_permission', function($permission, $download_id, $order_id) { | |
global $wpdb; | |
if (!$permission) { | |
if (!function_exists('wcs_get_subscriptions_for_order')) { | |
return $permission; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$email_hash = function_exists( 'hash' ) ? hash( 'sha256', $downloadable_product_permission->user_email ) : sha1( $downloadable_product_permission->user_email ); | |
$files[ $download_id ]['download_url'] = trailingslashit( get_option( 'home' )) .'?download_file='.$item_product_id.'&order='. $downloadable_product_permission->order_key .'&uid='. $email_hash .'&key='. $download_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
// Your LAN IP or host where you would want the live server | |
// Override this if you know your correct external IP (LAN) | |
// Otherwise, the system will always use localhost and will not | |
// work for external IP. | |
// This will also create some issues with file watching because for | |
// some reason, service-worker doesn't work on localhost? | |
// https://github.com/BrowserSync/browser-sync/issues/1295 | |
// So it is recommended to change this to your LAN IP. | |
// If you intend to access it from your LAN (probably do?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(d, t, g) { | |
var ph = d.createElement(t), | |
s = d.getElementsByTagName(t)[0]; | |
ph.type = 'text/javascript'; | |
ph.async = true; | |
ph.charset = 'UTF-8'; | |
ph.src = g + '&v=' + (new Date()).getTime(); | |
s.parentNode.insertBefore(ph, s); | |
})(document, 'script', '<?php ph_the_api_url($post_id); ?>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter("rest_pre_insert_ph_comment_location", "wp_145_disable_comments_approved_items", 10, 2); | |
add_filter("rest_pre_insert_phw_comment_loc", "wp_145_disable_comments_approved_items", 10, 2); | |
function wp_145_disable_comments_approved_items($prepared_post, $request) { | |
// if the item is approved, disallow comments | |
if (PH()->approvals->getStatus($prepared_post->meta_input['parent_id'])) { | |
return new WP_Error('comments_disabled', 'You are not allowed to comment since this has been approved.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter("rest_pre_insert_phw_comment_loc", "wp_145_limit_tasks", 10, 2); | |
function wp_145_limit_tasks($prepared_post, $request) { | |
if(!$project_id = $prepared_post->meta_input['project_id']) { | |
return $prepared_post; | |
} | |
// if it's our project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BunnyCDN { | |
public static function signUrl($url, $securityKey, $expiration_time = 3600, $user_ip = NULL, $is_directory_token = false, $path_allowed = NULL, $countries_allowed = NULL, $countries_blocked = NULL, $referers_allowed = NULL) | |
{ | |
if (!$user_ip) { | |
$user_ip = self::getUserIP(); | |
} | |
if (!is_null($countries_allowed)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'elementor/query/order_by_newdate', function( $query ) { | |
$query->set( 'meta_key', 'newdate' ); | |
$query->set( 'orderby', 'meta_value_num' ); | |
$query->set( 'order', 'DESC' ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_footer', function () { | |
global $post; | |
if (get_post_type($post) !== 'ph-project') { | |
return; | |
} ?> | |
<script> | |
ph.hooks.addFilter('approve_project_default', 'my_plugin', function() { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Changes all new comment subjects | |
*/ | |
add_filter("ph_mockup_new_comment_email_subject", function($subject, $id, $comment, $email) { | |
return "{{commenter}} added a new comment on {{project_name}} on {{ item_name }} with comment id of $id." | |
}, 10, 4); |