Пробуем отключить от functions.php: перенос рассчёта зодиака в класс.
This commit is contained in:
parent
963b928eb5
commit
55a31999d5
@ -150,7 +150,7 @@ EMPTY_SLOT;
|
|||||||
echo sprintf('<img src="/i/shadow/%s" alt="%s">', $this->shadow, $this->login);
|
echo sprintf('<img src="/i/shadow/%s" alt="%s">', $this->shadow, $this->login);
|
||||||
echo '</div><!-- slot-image -->';
|
echo '</div><!-- slot-image -->';
|
||||||
echo '<div class="user-signs">';
|
echo '<div class="user-signs">';
|
||||||
echo sprintf('<img src="i/zodiac/%s.png" alt="Родовой знак">', star_sign($this->borndate));
|
echo sprintf('<img src="i/zodiac/%s.png" alt="Родовой знак">', $this->showStarSign());
|
||||||
echo '</div><!-- user-signs -->';
|
echo '</div><!-- user-signs -->';
|
||||||
echo '<div class="user-info">';
|
echo '<div class="user-info">';
|
||||||
echo '<div class="stats-container">';
|
echo '<div class="stats-container">';
|
||||||
@ -179,4 +179,44 @@ EMPTY_SLOT;
|
|||||||
echo '</div><!-- user-info-container-lower -->';
|
echo '</div><!-- user-info-container-lower -->';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showStarSign() {
|
||||||
|
/*
|
||||||
|
* 1 aries
|
||||||
|
* 2 taurus
|
||||||
|
* 3 gemini
|
||||||
|
* 4 cancer
|
||||||
|
* 5 leo
|
||||||
|
* 6 virgo
|
||||||
|
* 7 libra
|
||||||
|
* 8 scorpio
|
||||||
|
* 9 sagittarios
|
||||||
|
* 10 capricorn
|
||||||
|
* 11 aquarius
|
||||||
|
* 12 pisches
|
||||||
|
*/
|
||||||
|
$zodiac[356] = "10";
|
||||||
|
$zodiac[326] = "09";
|
||||||
|
$zodiac[296] = "08";
|
||||||
|
$zodiac[266] = "07";
|
||||||
|
$zodiac[235] = "06";
|
||||||
|
$zodiac[203] = "05";
|
||||||
|
$zodiac[172] = "04";
|
||||||
|
$zodiac[140] = "03";
|
||||||
|
$zodiac[111] = "02";
|
||||||
|
$zodiac[78] = "01";
|
||||||
|
$zodiac[51] = "12";
|
||||||
|
$zodiac[20] = "11";
|
||||||
|
$zodiac[0] = "10";
|
||||||
|
$dayOfYear = date("z", strtotime($this->borndate));
|
||||||
|
$isLeapYear = date("L", strtotime($this->borndate)); //Высокосный?
|
||||||
|
if ($isLeapYear && $dayOfYear >59) {
|
||||||
|
--$dayOfYear;
|
||||||
|
}
|
||||||
|
foreach ($zodiac as $day => $sign) {
|
||||||
|
if ($dayOfYear > $day) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $sign ?? null;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user