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 sorter { | |
private $_array = array(); | |
function __construct($array) { | |
$this->_array = $array; | |
} | |
public function do_sort_size(){ |
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
$arr_str = array_map('trim', explode(',', $test_str)); //explode an array separated by coma and trim them | |
$arr_str = array_map(fn ($img) =>$img['url'], $detail['pics']); //get deep array that have url key from pics array |
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 | |
private function set_product_category_item($category, $parent_id = null) | |
{ | |
$taxonomy = 'product_cat'; | |
if (term_exists($category, $taxonomy)) { | |
$category_id = get_term_by('name', $category, $taxonomy)->term_id; | |
} else { | |
//$term_data = wp_insert_term($attributes['parent2'], $taxonomy, ['parent' => $parent_id_1]); | |
if(!empty($parent_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 | |
public function set_product_attribute($taxonomy, $terms, $isvariation = true) | |
{ | |
$taxonomyName = $this->taxonomy_create($taxonomy); | |
$terms = explode('|', $terms); | |
$term_ids = []; | |
foreach ($terms as $term_name) { | |
$term_name = mb_substr($term_name, 0, 200); |
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 | |
public function taxonomy_create($label) | |
{ | |
delete_transient('wc_attribute_taxonomies'); | |
\WC_Cache_Helper::incr_cache_prefix('woocommerce-attributes'); | |
// These are exported as labels, so convert the label to a name if possible first. | |
$attributeLabels = wp_list_pluck(wc_get_attribute_taxonomies(), 'attribute_label', 'attribute_name'); | |
//will produce |
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
var jsonData = JSON.parse(responseBody); | |
pm.collectionVariables.set('token', jsonData.token); |
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
const this_data = JSON.parse(pm.request.body.raw) | |
const ref_id = this_data.ref_id | |
const merchant_id = pm.variables.get('merchant_id'); | |
const secret = pm.variables.get('secret'); | |
const sign_str = `${secret}-${merchant_id}-${ref_id}`; | |
const signature = CryptoJS.MD5(sign_str).toString(); | |
pm.request.headers.add({ | |
key: "HTTP-X-APPAPI-AUTHORIZATION", | |
value: signature |
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
"PERIODE " + new SimpleDateFormat("d MMMMM yyyy").format(new SimpleDateFormat("yyyy-MM-dd").parse($P{tanggal})).toUpperCase() |
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 | |
function minuteDiff($str_interval, $dt_start, $dt_end, $relative = true){ | |
if( is_string( $dt_start)) $dt_start = date_create( $dt_start); | |
if( is_string( $dt_end)) $dt_end = date_create( $dt_end); | |
$diff = date_diff( $dt_start, $dt_end, !$relative); | |
switch( $str_interval){ | |
case "y": | |
$total = $diff->y + $diff->m / 12 + $diff->d / 365.25; break; |
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
function getParam(param){ | |
return new URLSearchParams(window.location.search).get(param); | |
} |
NewerOlder