stripslashes_deep_post($newvalue); $option_value = get_option($option_name); if( !empty($option_value) ){ $option_num = count($option_value); $unique = true; $sortnull = true; foreach( (array)$option_value as $value ){ if( $value['name'] == $newvalue['name'] ) $unique = false; if( !isset($value['sort']) ) $sortnull = false; $sort[] = $value['sort']; } if( !$unique ) return -1; rsort($sort); $next_number = reset($sort) + 1; $unique_sort = array_unique($sort); if( $option_num !== count($unique_sort) || $option_num !== $next_number || !$sortnull){ //To repair the sort data $i = 0; foreach( $option_value as $opkey => $opvalue ){ $option_value[$opkey]['sort'] = $i; $i++; } } } $newvalue['sort'] = !empty($option_num) ? $option_num : 0; $option_value[] = $newvalue; update_option($option_name, $option_value); krsort($option_value); $key_arr = each($option_value); $last_index = $key_arr['key']; return $last_index; } function usces_update_system_option( $option_name, $index, $newvalue ){ global $usces; $newvalue = $usces->stripslashes_deep_post($newvalue); $option_value = get_option($option_name); if( !empty($option_value) ){ $unique = true; foreach( (array)$option_value as $value_id => $value ){ if( $value['name'] == $newvalue['name'] && $value_id != $index ){ $unique = false; break; } } if( !$unique ) return -1; $option_value[$index] = $newvalue; update_option($option_name, $option_value); $lid = $index; }else{ $lid = -1; } return $lid; } function usces_get_system_option( $option_name, $keyflag = 'sort' ) { $sysopts = array(); $option_value = get_option($option_name); if( !is_array($option_value) ) return $sysopts; foreach( $option_value as $id => $value ){ $key = isset($value[$keyflag]) ? $value[$keyflag] : $value['sort']; switch( $option_name ){ case 'usces_payment_method': $sysopts[$key] = array( 'id' => $id, 'name' => $value['name'], 'explanation' => $value['explanation'], 'settlement' => $value['settlement'], 'module' => $value['module'], 'sort' => $value['sort'] ); break; } } ksort($sysopts); return $sysopts; } function usces_sort_system_option( $option_name, $idstr ) { global $usces; $option_value = get_option($option_name); if( !empty($option_value) ){ $ids = explode(',', $idstr); $c = 0; foreach( (array)$ids as $id ){ // usces_log('ids : '.$id.$c, 'acting_transaction.log'); $option_value[$id]['sort'] = $c; $c++; // usces_log('options : '.print_r($option_value,true), 'acting_transaction.log'); } update_option( $option_name, $option_value ); } return; } function usces_del_system_option( $option_name, $id ) { global $usces; $option_value = get_option($option_name); if( !empty($option_value) && isset($option_value[$id]) && !empty($option_value)){ unset($option_value[$id]); $op = array(); foreach( (array)$option_value as $opkey => $opvalue ){ $op[$opvalue['sort']] = $opkey; } ksort($op); $c = 0; foreach( $op as $opid ){ $option_value[$opid]['sort'] = $c; $c++; } update_option( $option_name, $option_value ); } return; } /** * payment_list */ function payment_list( $option_value ) { // Exit if no meta if ( empty($option_value) ) { ?>
 
 
' onclick="payment.post('del', );" /> ' onclick="payment.post('update', );" />

:

options['province']; //20110331ysk start //$prefs = $usces_states[$country]; //20120710ysk start 0000472 //$prefs = get_usces_states($country); //20110331ysk end //20110317ysk end //array_shift($prefs); $target_market = ( isset($options['system']['target_market']) && !empty($options['system']['target_market']) ) ? $options['system']['target_market'] : usces_get_local_target_market(); foreach( (array)$target_market as $tm ) { $prefs = get_usces_states($tm); array_shift($prefs); $value = $_POST['value_'.$tm]; //20120710ysk end $options['shipping_charge'][$index]['id'] = $newid; $options['shipping_charge'][$index]['name'] = $name; //20110317ysk start //20120710ysk start 0000472 //$options['shipping_charge'][$index]['country'] = $country; //20110317ysk end //$options['shipping_charge'][$index]["value"] = array(); //for($i=0; $ioptions['province']; //20110331ysk start //$prefs = $usces_states[$country]; //20120710ysk start 0000472 //$prefs = get_usces_states($country); //20110331ysk end //20110317ysk end //array_shift($prefs); //20120710ysk end for($i=0; $ioptions['province']; //20110331ysk start //$prefs = $usces_states[$country]; //20120710ysk start 0000472 //$prefs = get_usces_states($country); //20110331ysk end //20110317ysk end //array_shift($prefs); $target_market = ( isset($options['system']['target_market']) && !empty($options['system']['target_market']) ) ? $options['system']['target_market'] : usces_get_local_target_market(); foreach( (array)$target_market as $tm ) { $prefs = get_usces_states($tm); array_shift($prefs); $value = $_POST['value_'.$tm]; //20120710ysk end $options['delivery_days'][$index]['id'] = $newid; $options['delivery_days'][$index]['name'] = $name; //20110317ysk start //20120710ysk start 0000472 //$options['delivery_days'][$index]['country'] = $country; //20110317ysk end //for($i=0; $ioptions['province']; //20110331ysk start //$prefs = $usces_states[$country]; //20120710ysk start 0000472 //$prefs = get_usces_states($country); //20110331ysk end //20110317ysk end //array_shift($prefs); //20120710ysk end for($i=0; $i