Plugin Directory

Changeset 3310870


Ignore:
Timestamp:
06/13/2025 07:14:26 AM (10 months ago)
Author:
denishua
Message:

version 6.8.0.3

Location:
wpjam-basic/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wpjam-basic/trunk/includes/class-wpjam-args.php

    r3310758 r3310870  
    550550        if($args){
    551551            if(is_array($args[0])){
     552                $output = $args[1] ?? null;
    552553                $args   = $args[0];
    553                 $output = $args[1] ?? null;
    554554            }else{
    555555                $args   = [$args[0]=> $args[1]];
     
    932932        foreach($items as $i => $item){
    933933            if($args['calc']){
    934                 $item   = $this->calc($item);
     934                if(is_array($args['calc']) && !empty($args['key']) && isset($args['calc'][$item[$args['key']]])){
     935                    $item   = array_merge($item, $args['calc'][$item[$args['key']]]);
     936                }else{
     937                    $item   = $this->calc($item);
     938                }
    935939            }
    936940
     
    10631067    }
    10641068
    1065     public function accumulate($results, $items, $group=''){
     1069    public function accumulate($results, $items, $args=[]){
     1070        $field  = wpjam_pull($args, 'field');
     1071        $calc   = wpjam_pull($args, 'calc');
     1072        $items  = wp_is_numeric_array($items ) ? $items : [$items];
     1073
    10661074        foreach($items as $item){
    1067             $item   = $this->calc($item);
    1068             $value  = $group ? ($item[$group] ?? '') : '__';
     1075            $item   = $calc ? $this->calc($item) : $item;
     1076            $value  = $field ? ($item[$field] ?? '') : '__';
    10691077            $keys   = $this->sumable ? array_keys(array_filter($this->sumable, fn($v)=> $v == 1)) : [];
    10701078
     
    10781086        }
    10791087
    1080         return $group ? $results : $results[$value];
     1088        return $field ? $results : $results[$value];
    10811089    }
    10821090
  • wpjam-basic/trunk/wpjam-basic.php

    r3310758 r3310870  
    44Plugin URI: https://blog.wpjam.com/project/wpjam-basic/
    55Description: WPJAM 常用的函数和接口,屏蔽所有 WordPress 不常用的功能。
    6 Version: 6.8.0.2
     6Version: 6.8.0.3
    77Requires at least: 6.6
    88Tested up to: 6.8
Note: See TracChangeset for help on using the changeset viewer.