function displaySearchForm()
{
    global $bedsBaths;
    global $resultsPage;
    global $showAreas;
    global $showSubtypes;
    global $locationsJSON;
    global $typesJSON;
    global $searchType;
    global $resultSearchType;
    global $currencies;
    global $energyRatings;
    global $showCurrency;
    global $showBeds;
    global $showBaths;
    global $showRating;
    global $languageArr;
    global $datePickerLanguages;
    global $language;
    global $showFeature;
    global $featuresLanguage;
    global $showChosen;
    $currencies = array('EUR', 'GBP', 'USD');
    $energyRatings = array();
    $rateKeys = array();
    for ($i = 1; $i <= 16; $i++) {
        $rateKeys[] = $i;
    }
    $energyRatings = getEnergyRatingLanguage($rateKeys);
    $bedsBaths = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    $bedsData = getBedBathLanguage(array('1', '2', '3', '4', '5', '6', '7', '8', '9'));
    $bathsData = getBedBathLanguage(array('1', '2', '3', '4', '5', '6', '7', '8'), 'bathrooms');
    $currencyIcon = array('EUR' => '&euro;', 'GBP' => '&pound;', 'USD' => '$');
    $priceRange = generateRange(10000, 10000000, 5000);
    $priceRangeRentalLT = generateRange(450, 5000, 50);
    $priceRangeRentalST = generateRange(300, 5000, 50);
    $locationsList = formatSelectOptions(getLocations());
    $featureCategories = groupCategory();
    $featureList = '';
    $featureArrs = array_map("trim", explode(",", $showFeature));
    $currentCategoryName = '';
    $tmpText = '';
    foreach ($featureCategories['groupCategoryData'] as $k => $v) {
        foreach ($v as $item) {
            if (in_array($item['ConfigCategoryName'], $featureArrs)) {
                if ($item['CategoryName'] != $currentCategoryName) {
                    if ($currentCategoryName != '') {
                        $featureList .= TemplateHelper::render('templates/featureListItem.html', array('Search.Feature.More.Title' => $currentCategoryName, 'Search.Feature.More.Items' => $tmpText));
                    }
                    $currentCategoryName = $item['CategoryName'];
                    $tmpText = '';
                }
                $tmpText .= '<div class="col-xs-6"><input class="feature-more text-nowrap" type="checkbox" value="' . $item['OptionName'] . '" />&nbsp;' . $item['FeatureName'] . '</div>';
            }
        }
    }
    if ($tmpText != '') {
        $featureList .= TemplateHelper::render('templates/featureListItem.html', array('Search.Feature.More.Title' => $currentCategoryName, 'Search.Feature.More.Items' => $tmpText));
    }
    $searchForm = TemplateHelper::render('templates/searchForm.html', array('Search.Form.Action' => $resultsPage, 'Search.PropertyId' => $languageArr['field_Headings']['prop_Id'], 'Search.SearchType.ForSale' => $languageArr['search_Types']['for_Sale'], 'Search.SearchType.LongTerm' => $languageArr['search_Types']['longTerm_Rent'], 'Search.SearchType.ShortTerm' => $languageArr['search_Types']['shortTerm_Rent'], 'Search.Rental.From' => $languageArr['field_Headings']['rental_From'], 'Search.Rental.To' => $languageArr['field_Headings']['rental_To'], 'Search.Area.Options' => formatAreaSelectOptions(getAreas()), 'Search.Location.Placeholder' => $languageArr['field_Headings']['select_Locations'], 'Search.Location.NoRef' => $languageArr['field_Headings']['option_NoPref'], 'Search.Location.Options' => $locationsList, 'Search.PropertyType.Placeholder' => $languageArr['field_Headings']['select_Types'], 'Search.PropertyType.NoRef' => $languageArr['field_Headings']['option_NoPref'], 'Search.PropertyType.Options' => formatSearchTypeGroupOption(getAllPropertyTypes()), 'Search.Feature.Placeholder' => $languageArr['field_Headings']['select_Features'], 'Search.Feature.NoRef' => $languageArr['field_Headings']['option_NoPref'], 'Search.Feature.Options' => formatFeatureOption($featureCategories['groupCategoryData']), 'Search.Feature.More.List' => $featureList, 'Search.Beds.NoRef' => $languageArr['field_Headings']['bedrooms']['header'], 'Search.Beds.Options' => formatOptions($bedsData), 'Search.Baths.NoRef' => $languageArr['field_Headings']['bathrooms']['header'], 'Search.Baths.Options' => formatOptions($bathsData), 'Search.MinPrice.Title' => $languageArr['field_Headings']['price_Min'], 'Search.MinPrice.Placeholder' => $languageArr['field_Headings']['price_Min'], 'Search.MaxPrice.Title' => $languageArr['field_Headings']['price_Max'], 'Search.MaxPrice.Placeholder' => $languageArr['field_Headings']['price_Max'], 'Search.Currency.NoRef' => $languageArr['field_Headings']['currency'], 'Search.Currency.Options' => formatOptions($currencies, false), 'Search.EnergyRating.NoRef' => $languageArr['field_Headings']['energyRating']['header'], 'Search.EnergyRating.Options' => formatOptions($energyRatings), 'Search.Button.Submit' => $languageArr['field_Headings']['search_Button'], 'Search.Location.JSON' => $locationsJSON, 'Search.Types.JSON' => $typesJSON, 'Search.Price.RangeData' => json_encode($priceRange), 'Search.Price.RangeRentalLongTermData' => json_encode($priceRangeRentalLT), 'Search.Price.RangeRentalShortTermData' => json_encode($priceRangeRentalST), 'Search.TypeData' => $searchType, 'Search.ResultPage' => $resultsPage, 'Search.Currency.Old' => isset($_SESSION["currency"]) ? $_SESSION["currency"] : 'EUR', 'Search.LanguageCode' => $datePickerLanguages[$language], 'Search.ShowChosen' => $showChosen), array('showAreas' => $showAreas, 'showBeds' => $showBeds, 'showBaths' => $showBaths, 'showCurrency' => $showCurrency, 'showRating' => $showRating, 'showChosen' => $showChosen));
    echo $searchForm;
}
        $curEnd = hexdec(substr($range, 4));
        if (!isset($bufStart)) {
            $bufStart = $curStart;
            $bufEnd = $curEnd;
            continue;
        }
        if ($curStart <= $bufEnd + 1) {
            // extend the buffered range
            $bufEnd = max($bufEnd, $curEnd);
        } else {
            // dump the buffered range and unset it
            $str .= generateRange($bufStart, $bufEnd);
            $bufStart = $curStart;
            $bufEnd = $curEnd;
        }
    }
    if (isset($bufStart)) {
        $str .= generateRange($bufStart, $bufEnd);
    }
    $props[$propName] = $str;
}
ksort($props);
$php = trim(var_export($props, true), "ary (\r\n),");
$php = str_replace("\r\n", "\n", $php);
$php = str_replace('  ', "\t\t", $php);
$php = " = [\n\t\t" . $php . "\n\t]";
$file = file_get_contents($filepath);
$file = preg_replace('#(protected static \\$unicodeProps)(.*?)\\n\\t[\\])];#s', '$1;', $file);
$file = str_replace('protected static $unicodeProps;', 'protected static $unicodeProps' . $php . ';', $file);
file_put_contents($filepath, $file);
echo "Done.\n";
示例#3
0
<?php

// define a simple range generator
function generateRange($start, $end, $step = 1)
{
    for ($i = $start; $i < $end; $i += $step) {
        // yield one result at a time
        (yield $i);
    }
}
function generateRange2($start, $end, $step = 1)
{
    for ($i = $start; $i < $end; $i += $step) {
        // yield one result at a time
        (yield $i[1]);
        (yield $i->y ? 'd' : 2 + 2);
    }
}
foreach (generateRange(0, 1000000) as $number) {
    echo $number;
}