本文整理汇总了PHP中Ubirimi\Util::getCountries方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getCountries方法的具体用法?PHP Util::getCountries怎么用?PHP Util::getCountries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ubirimi\Util
的用法示例。
在下文中一共展示了Util::getCountries方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$settings = $this->getRepository(UbirimiUser::class)->getYongoSettings($session->get('user/id'));
$countries = Util::getCountries();
return $this->render(__DIR__ . '/../../Resources/views/user/UpdatePreferencesConfirm.php', get_defined_vars());
}
示例2: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$session->remove('user_account_created');
$httpHOST = Util::getHttpHost();
$clientDomain = Util::getSubdomain();
$clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id');
$client = $this->getRepository(UbirimiClient::class)->getById($clientId);
$clientSettings = $this->getRepository(UbirimiClient::class)->getSettings($clientId);
$countries = Util::getCountries();
$errors = array('empty_email' => false, 'email_not_valid' => false, 'empty_first_name' => false, 'empty_last_name' => false, 'email_already_exists' => false, 'empty_username' => false, 'empty_password' => false, 'password_mismatch' => false, 'duplicate_username' => false, 'invalid_username' => false);
if ($request->request->has('cancel')) {
return new RedirectResponse('/');
} else {
if ($request->request->has('create-user-account')) {
$email = Util::cleanRegularInputField($request->request->get('email'));
$firstName = Util::cleanRegularInputField($request->request->get('first_name'));
$lastName = Util::cleanRegularInputField($request->request->get('last_name'));
$username = Util::cleanRegularInputField($request->request->get('username'));
$password = Util::cleanRegularInputField($request->request->get('password'));
$passwordAgain = Util::cleanRegularInputField($request->request->get('password_again'));
$countryId = $request->request->get('country');
if (empty($email)) {
$errors['empty_email'] = true;
} else {
if (!Util::isValidEmail($email)) {
$errors['email_not_valid'] = true;
}
}
$emailData = $this->getRepository(UbirimiUser::class)->getUserByClientIdAndEmailAddress($clientId, mb_strtolower($email));
if (!Util::validateUsername($username)) {
$errors['invalid_username'] = true;
} else {
$userData = $this->getRepository(UbirimiUser::class)->getByUsernameAndClientId($username, $clientId);
if ($userData) {
$errors['duplicate_username'] = true;
}
}
if ($emailData) {
$errors['email_already_exists'] = true;
}
if (empty($firstName)) {
$errors['empty_first_name'] = true;
}
if (empty($lastName)) {
$errors['empty_last_name'] = true;
}
if (empty($username)) {
$errors['empty_username'] = true;
}
if (empty($password)) {
$errors['empty_password'] = true;
}
if ($password != $passwordAgain) {
$errors['password_mismatch'] = true;
}
if (Util::hasNoErrors($errors)) {
$userId = UbirimiContainer::get()['user']->newUser(array('clientId' => $clientId, 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'username' => $username, 'password' => $password, 'clientDomain' => $client['company_domain'], 'country' => $countryId));
$session->set('user_account_created', true);
$email = $firstName = $lastName = $username = $password = $passwordAgain = $email = null;
}
}
}
$content = 'Signup.php';
return $this->render(__DIR__ . '/../Resources/views/_main.php', get_defined_vars());
}