summaryrefslogtreecommitdiff
path: root/includes/util/bitset.inc
blob: 131cb39938a4a1a8a7558519e9d25bd5d505032d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

function parseMetadata ($metadata) {
    $metadata["little"] = 0;

    $age = -1;

    if (isset($metadata["birth"]["age"]) && $metadata["birth"]["age"] !== 0) {
        $age = $metadata["birth"]["age"];
    } else if (isset($metadata["birth"]["year"]) && $metadata["birth"]["year"] > 1990) {
        $age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1);
    }

    if ($age > 0 && $age <= 10) {
        $metadata["little"] = 2;
    } else if ($age > 0 && $age <= 15) {
        $metadata["little"] = 3;
    }

    return $metadata;
}