Create the function sortArray() public function sortArray(&$array, $subkey=”id”, $sort_ascending=true) { if (count($array)) $temp_array[key($array)] = array_shift($array); foreach($array as $key => $val){ $offset = 0; $found = false; foreach($temp_array as $tmp_key => $tmp_val) { if(!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { $temp_array = array_merge( (array)array_slice($temp_array,0,$offset), array($key => $val), array_slice($temp_array,$offset) ); $found = true; } $offset++; } if(!$found) $temp_array […]
Woocommerce Checkout JS events $( document.body ).trigger( ‘init_checkout’ ); $( document.body ).trigger( ‘payment_method_selected’ ); $( document.body ).trigger( ‘update_checkout’ ); $( document.body ).trigger( ‘updated_checkout’ ); $( document.body ).trigger( ‘checkout_error’ ); $( document.body ).trigger( ‘applied_coupon_in_checkout’ ); $( document.body ).trigger( ‘removed_coupon_in_checkout’ ); Woocommerce cart page JS events $( document.body ).trigger( ‘wc_cart_emptied’ ); $( document.body ).trigger( ‘update_checkout’ ); $( […]
echo “PATH=/opt/plesk/php/7.1/bin:$PATH” >> ~/.bash_profile Replace the version number with the one you have set. Then close out the terminal and reopen. Run php -v and you should see the correct version. php -v PHP 7.4.27 (cli) (built: Dec 23 2021 14:48:17) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) […]
var json = canvas.toJSON(); canvas.clear(); canvas.loadFromJSON(json, canvas.renderAll.bind(canvas));
canvas.setWidth( <desired width> ); canvas.setHeight( <desired height> ); canvas.calcOffset();
var arrayVar = [ { name: ‘Bobby’, someValue: 123123 }, { name: ‘Phillip’, someValue: 123 } ]; arrayVar = arrayVar.sort((a, b) => {return a.someValue – b.someValue}); // save the sort result // (a – b) = Ascending sort, (b – a) = Descending sort console.log(arrayVar);
var grammar = ‘#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | […]