Пример #1
0
            $imgPath = LOGO_STORE . ($urlExists[$img] ? $img : LOGO_DEFAULT);
            echo "{$img} has been already controlled\n";
        } else {
            $header_response = get_headers(LOGO_STORE . $img, 1);
            // echo $header_response[0] . "\n";
            $urlExists[$img] = !strpos($header_response[0], "404");
            $imgPath = LOGO_STORE . ($urlExists[$img] ? $img : LOGO_DEFAULT);
        }
    }
    $data[$i][$descrKey] = $text;
    $data[$i][$logoKey] = $imgPath;
}
// end elaboration
// exit();
$parser = new DataParser();
$data = $parser->renameKeys($data, $replacements);
$data = $parser->repairFragmentsInArray($data);
include 'clicktags.php';
$urls = clickTags();
$dataGrouped = $parser->groupBy($data, '#PLACEHOLDER1#');
// rearrange $sectorsData in order to have a hash map from companies names to array of hash maps
// of with company's sectors and corresponding adv links
$companyToSectors = $parser->groupBy($sectorsData, 'company');
// create well-formed string containing links to the sectors correspondign to each company name
$companyToSectorsText = [];
foreach ($companyToSectors as $companyName => $arr) {
    $text = [];
    $len = count($arr);
    for ($i = 0; $i < $len; $i++) {
        $tmp = str_replace('#SECTOR_URL#', $arr[$i]['adv_link'], SINGLE_SECTOR_TEMPLATE);
        $sectorNameSanitized = $parser->escapeSymbols($arr[$i]['settori']);