<?php
namespace X0815\ZodiacSigns\XF\Entity;
class UserProfile extends XFCP_UserProfile
{
public function getAge($bypassPrivacy = false)
{
$age = parent::getAge($bypassPrivacy);
if(\X0815\ZodiacSigns\Listener::$_blurber !== false && $this->User->Option->show_zodiac && $this->dob_month && $this->dob_day)
{
$zodiac = $this->getZodiacSign($this->dob_day, $this->dob_month);
if($zodiac !== 'none')
{
$zodiacMode = \XF::options()->zodiacModus;
if($zodiacMode == 'text')
{
$zodiac_data = \XF::phrase('zodiac_' . $zodiac);
}
else
{
$zodiac_data = $this->getZodiacIcon($zodiac);
}
$templater = $this->app()->templater();
$zodiacExplain = $templater->filterForAttr($templater, \XF::phrase('zodiac_' . $zodiac . '_explain'), $null);
$seperator = $age !== false ? $age . ' <span role="presentation" aria-hidden="true">·</span> ' : '';
return $seperator . "<span class=\"zodiac-sign zodiac-sign--{$zodiac}\" data-xf-init=\"tooltip\" data-content=\"{$zodiacExplain}\" data-trigger=\"hover focus click\">{$zodiac_data}</span>";
}
}
return $age;
}
protected function getZodiacSign(int $day = null, int $month = null): string
{
if(($month == 1 && $day > 20) || ($month == 2 && $day < 20))
{
return 'aquarius';
}
elseif(($month == 2 && $day > 18) || ($month == 3 && $day < 21))
{
return 'pisces';
}
elseif(($month == 3 && $day > 20) || ($month == 4 && $day < 21))
{
return 'aries';
}
elseif(($month == 4 && $day > 20) || ($month == 5 && $day < 22))
{
return 'taurus';
}
elseif(($month == 5 && $day > 21) || ($month == 6 && $day < 22))
{
return 'gemini';
}
elseif(($month == 6 && $day > 21) || ($month == 7 && $day < 24))
{
return 'cancer';
}
elseif(($month == 7 && $day > 23) || ($month == 8 && $day < 24))
{
return 'leo';
}
elseif(($month == 8 && $day > 23) || ($month == 9 && $day < 24))
{
return 'virgo';
}
elseif(($month == 9 && $day > 23) || ($month == 10 && $day < 24))
{
return 'libra';
}
elseif(($month == 10 && $day > 23) || ($month == 11 && $day < 23))
{
return 'scorpio';
}
elseif(($month == 11 && $day > 22) || ($month == 12 && $day < 23))
{
return 'sagittarius';
}
elseif(($month == 12 && $day > 22) || ($month == 1 && $day < 21))
{
return 'capricorn';
}
return 'none';
}
protected function getZodiacIcon($zodiac)
{
switch ($zodiac)
{
case 'aquarius':
return '♒';
case 'pisces':
return '♋';
case 'aries':
return '♈';
case 'taurus':
return '♉';
case 'gemini':
return '♊';
case 'cancer':
return '♋';
case 'leo':
return '♌';
case 'virgo':
return '♍';
case 'libra':
return '♎';
case 'scorpio':
return '♏';
case 'sagittarius':
return '♐';
case 'capricorn':
return '♈';
}
return false;
}
}
if(false)
{
class XFCP_UserProfile extends \XF\Entity\UserProfile {}
}