This file contains hidden or 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 | |
// Context : emergency project where there are hundreds of broken pages; not sure why, I came to fix it | |
// This is just one small part, yet the most hackish, I've had to do, because Gutenberg scripts the entire $attributes | |
// On the block before it reached the `acf_render_block_callback` | |
add_filter( 'block_parser_class', function() { | |
return 'X_WP_Block_Parser'; | |
}); |
This file contains hidden or 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 | |
// Replace my_prefix with something else, includes AS Group | |
/** | |
* @param string $endpoint | |
* @param \Wprus_Api_Abstract $object | |
*/ | |
function _my_prefix_wp_notify_remote_after_init_notification_hooks( $endpoint, $object ) { | |
if( !function_exists( 'as_enqueue_async_action' ) ) |
This file contains hidden or 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( 'add_meta_boxes', function() { | |
add_meta_box( | |
'wc-subscription-scheduled-actions', | |
__( 'WC Subscription Scheduled Actions' ), | |
function( $post ) { | |
$actions = as_get_scheduled_actions( [ | |
'args' => [ | |
'subscription_id' => $post->ID |
This file contains hidden or 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
// PayPal, please don't change the name of this. | |
if( typeof window.paypal.__internal_destroy__ === 'function' ) | |
window.paypal.__internal_destroy__(); |
This file contains hidden or 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 | |
function _lorem_ipsum_setting_to_css_variable_color( $settings, $index ) { | |
if( isset( $settings[ '__globals__' ] ) && isset( $settings[ '__globals__' ][ $index ] ) ) { | |
if( strpos( $settings[ '__globals__' ][ $index ],'?id=' ) !== false ) { | |
$identifier = substr( $settings[ '__globals__' ][ $index ], strpos( $settings[ '__globals__' ][ $index ],'?id=' ) + 4 ); | |
return 'var( --e-global-color-' . $identifier . ' )'; | |
} | |
} |
This file contains hidden or 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 | |
// Load WordPress. | |
require( 'wp-load.php' ); | |
$site_url = get_site_url(); | |
$latest_5_post_ids = get_posts([ | |
'posts_per_page' => 5, | |
'paged' => 1, | |
'post_type' => [ 'post' ], |
This file contains hidden or 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 | |
return [ | |
'AF' => 'AFN', | |
'AL' => 'ALL', | |
'DZ' => 'DZD', | |
'AS' => 'USD', | |
'AD' => 'EUR', | |
'AO' => 'AOA', | |
'AI' => 'XCD', |
This file contains hidden or 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 | |
// The goal is to prevent human error, not cheating the system. | |
class Sample { | |
private static $_cnpValidationConstant = "279146358279"; | |
public static function isValidCNP( $cnp ) { | |
$cnp = intval( $cnp ); |
This file contains hidden or 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
Some context : | |
I need to do instant push notifications with one-signal when someone posts a comment, and I must ensure there's no compromise on the speed, it seems to add to the load time from 1 device to 5 devices receiving notifications, and gets slower and slower as I'm going to 100 devices, because of the way these tokens work, a user could artifically get 1000s of device tokens in onesignal ( assumption ), cleaning them up trough a cron job would be another thing I'll tackle, but later ( if someone gets here with similar requirements, a heads up ) | |
I'm looking for suggestions, or weak points in my logic, if anyone ever encountered this, or simply want to talk about it, maybe there's a better way of approaching this, or WP Core has something better available. | |
Why I want to use an Async Request : | |
I can't work with cron jobs, because I want this to happen instantly, I'm essentially turning 1 POST request into another GET request, my other option would be to have an infinite loop somewhere always happening, |
This file contains hidden or 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
eLearnCommerce.Library.Editablementions = { | |
configuration : { | |
container_class : 'wpep-discussion-mention-item', | |
container_user_id_attr : 'data-wpep-mention-user-id', | |
image_class : 'wpep-discussion-mention-item-image', | |
name_class : 'wpep-discussion-mention-item-name' | |
}, | |
_currentXHRSearch : false, |
NewerOlder