Given a list of items see what ones need to be inserted/updated or deleted.

Paramètres

array $defaults: Array of default values, representing a row in the db.

mixed $new_values: Array of edited values, representing a row in the db.

Return value

array Nested array strucutre; only the diff.

2 calls to advagg_diff_multi()
advagg_critical_css_admin_settings_form_submit dans advagg_critical_css/advagg_critical_css.admin.inc
Submit callback, process the advagg_critical_css form.
advagg_relocate_admin_settings_form_submit dans advagg_relocate/advagg_relocate.admin.inc
Submit callback, clear out the advagg cache bin.

Fichier

./advagg.module, line 7009

Code

function advagg_diff_multi(array $defaults, $new_values) {
    $result = array();
    foreach ($defaults as $key => $val) {
        if (is_array($val) && isset($new_values[$key])) {
            $tmp = advagg_diff_multi($val, $new_values[$key]);
            if ($tmp) {
                $result[$key] = $tmp;
            }
        }
        elseif (!isset($new_values[$key])) {
            $result[$key] = NULL;
        }
        elseif ($val != $new_values[$key]) {
            $result[$key] = $new_values[$key];
        }
        if (isset($new_values[$key])) {
            unset($new_values[$key]);
        }
    }
    $result = $result + $new_values;
    return $result;
}