本文整理汇总了PHP中opToolkit::isMobileEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP opToolkit::isMobileEmailAddress方法的具体用法?PHP opToolkit::isMobileEmailAddress怎么用?PHP opToolkit::isMobileEmailAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opToolkit
的用法示例。
在下文中一共展示了opToolkit::isMobileEmailAddress方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
parent::save();
$emailAddress = $this->member->getEmailAddress();
$params = array('mailAddress' => $emailAddress, 'newPassword' => $this->plainPassword, 'isMobile' => opToolkit::isMobileEmailAddress($emailAddress));
$this->sendConfirmMail($emailAddress, $params);
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
parent::execute($arguments, $options);
sfContext::createInstance($this->createConfiguration('pc_frontend', 'prod'), 'pc_frontend');
$pcGadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName('dailyNews');
$mobileGadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName('mobileDailyNews');
$targetMembers = Doctrine::getTable('Member')->findAll();
foreach ($targetMembers as $member) {
if (!$member->getConfig('daily_news')) {
continue;
}
if (1 == $member->getConfig('daily_news') && !$this->isDailyNewsDay()) {
continue;
}
$address = $member->getEmailAddress();
$gadgets = $pcGadgets['dailyNewsContents'];
if (opToolkit::isMobileEmailAddress($address)) {
$gadgets = $mobileGadgets['mobileDailyNewsContents'];
}
$filteredGadgets = array();
if ($gadgets) {
foreach ($gadgets as $gadget) {
if ($gadget->isEnabled()) {
$filteredGadgets[] = array('component' => array('module' => $gadget->getComponentModule(), 'action' => $gadget->getComponentAction()), 'gadget' => $gadget, 'member' => $member);
}
}
}
$context = $this->getContextByEmailAddress($address);
$params = array('member' => $member, 'gadgets' => $filteredGadgets, 'subject' => $context->getI18N()->__('デイリーニュース'), 'today' => time());
opMailSend::sendTemplateMail('dailyNews', $address, opConfig::get('admin_mail_address'), $params, $context);
}
}
示例3: sendTemplateMail
public static function sendTemplateMail($template, $to, $from, $params = array(), $context = null)
{
if (!$to) {
return false;
}
if (empty($params['target'])) {
$target = opToolkit::isMobileEmailAddress($to) ? 'mobile' : 'pc';
} else {
$target = $params['target'];
}
if (in_array($target . '_' . $template, Doctrine::getTable('NotificationMail')->getDisabledNotificationNames())) {
return false;
}
if (null === $context) {
$context = sfContext::getInstance();
}
$body = self::getMailTemplate($template, $target, $params, false, $context);
$signature = self::getMailTemplate('signature', $target, array(), true, $context);
if ($signature) {
$signature = "\n" . $signature;
}
$subject = $params['subject'];
$notificationMail = Doctrine::getTable('NotificationMail')->fetchTemplate($target . '_' . $template);
if ($notificationMail instanceof NotificationMail && $notificationMail->getTitle()) {
$subject = $notificationMail->getTitle();
$templateStorage = new sfTemplateStorageString($subject);
$renderer = new opTemplateRendererTwig();
$params['sf_type'] = null;
$parameterHolder = new sfViewParameterHolder($context->getEventDispatcher(), $params);
$subject = $renderer->evaluate($templateStorage, $parameterHolder->toArray());
$notificationMail->free(true);
}
return self::execute($subject, $to, $from, $body . $signature);
}
示例4: sendDailyNews
private function sendDailyNews($app)
{
$isAppMobile = 'mobile_frontend' === $app;
$dailyNewsName = $isAppMobile ? 'mobileDailyNews' : 'dailyNews';
$context = sfContext::createInstance($this->createConfiguration($app, 'prod'), $app);
$gadgets = Doctrine::getTable('Gadget')->retrieveGadgetsByTypesName($dailyNewsName);
$gadgets = $gadgets[$dailyNewsName . 'Contents'];
$targetMembers = Doctrine::getTable('Member')->findAll();
foreach ($targetMembers as $member) {
$address = $member->getEmailAddress();
if ($isAppMobile !== opToolkit::isMobileEmailAddress($address)) {
continue;
}
$dailyNewsConfig = $member->getConfig('daily_news');
if (null !== $dailyNewsConfig && 0 === (int) $dailyNewsConfig) {
continue;
}
if (1 === (int) $dailyNewsConfig && !$this->isDailyNewsDay()) {
continue;
}
$filteredGadgets = array();
if ($gadgets) {
foreach ($gadgets as $gadget) {
if ($gadget->isEnabled($member)) {
$filteredGadgets[] = array('component' => array('module' => $gadget->getComponentModule(), 'action' => $gadget->getComponentAction()), 'gadget' => $gadget, 'member' => $member);
}
}
}
$params = array('member' => $member, 'gadgets' => $filteredGadgets, 'subject' => $context->getI18N()->__('デイリーニュース'), 'today' => time());
opMailSend::sendTemplateMail('dailyNews', $address, opConfig::get('admin_mail_address'), $params, $context);
}
}
示例5: doClean
/**
* @see sfValidatorString
*/
protected function doClean($value)
{
$clean = parent::doClean($value);
if (opToolkit::isMobileEmailAddress($clean)) {
throw new sfValidatorError($this, 'invalid', array('value' => $value));
}
return $clean;
}
示例6: getContextByEmailAddress
protected function getContextByEmailAddress($address)
{
$application = 'pc_frontend';
if (opToolkit::isMobileEmailAddress($address)) {
$application = 'mobile_frontend';
}
if (!sfContext::hasInstance($application)) {
$context = sfContext::createInstance($this->createConfiguration($application, 'prod'), $application);
} else {
$context = sfContext::getInstance($application);
}
return $context;
}
示例7: checkSecretQuestion
public function checkSecretQuestion($validator, $values, $arguments = array())
{
$configName = opToolkit::isMobileEmailAddress($values['mail_address']) ? 'mobile_address' : 'pc_address';
$memberConfig = Doctrine::getTable('MemberConfig')->findOneByNameAndValue($configName, $values['mail_address']);
if (!$memberConfig) {
throw new sfValidatorError($validator, 'invalid');
}
$this->member = $memberConfig->Member;
if ($values['secret_question'] != $this->member->getConfig('secret_question')) {
throw new sfValidatorError($validator, 'invalid');
}
// To keep backward compatibility with OpenPNE 1.x, your answer is checked as Shift-JIS too.
if (!in_array($this->member->getConfig('secret_answer'), array(md5($values['secret_answer']), md5(mb_convert_encoding($values['secret_answer'], 'SJIS-win', 'UTF-8'))))) {
throw new sfValidatorError($validator, 'invalid');
}
return $values;
}
示例8: sendTemplateMail
public static function sendTemplateMail($template, $to, $from, $params = array(), $context = null)
{
if (!$to) {
return false;
}
if (empty($params['target'])) {
$target = opToolkit::isMobileEmailAddress($to) ? 'mobile' : 'pc';
} else {
$target = $params['target'];
}
if (in_array($target . '_' . $template, Doctrine::getTable('NotificationMail')->getDisabledNotificationNames())) {
return false;
}
$body = self::getMailTemplate($template, $target, $params, false, $context);
$signature = self::getMailTemplate('signature', $target, array(), true, $context);
if ($signature) {
$signature = "\n" . $signature;
}
return self::execute($params['subject'], $to, $from, $body . $signature);
}
示例9: __call
public function __call($name, $arguments)
{
if (0 === strpos($name, 'set')) {
$data = $arguments[0];
$key = $arguments[1];
if (in_array($key, $this->profiles)) {
if (empty($data[$key])) {
return null;
}
$this->setMemberProfile($this->member, $this->tableToOpenPNE[$key], array_shift($data[$key]));
} elseif (in_array($key, $this->names)) {
$nickname = $this->getValue($data, 'namePerson/friendly');
if (!$nickname) {
$nickname = $this->getValue($data, 'namePerson');
}
$this->member->setName(array_shift($nickname));
} elseif (in_array($key, $this->emails)) {
$email = $this->getValue($data, 'contact/email');
if (!$email) {
return null;
}
$email = array_shift($email);
if (opToolkit::isMobileEmailAddress($email)) {
$this->member->setConfig('mobile_address', $email);
} else {
$this->member->setConfig('pc_address', $email);
}
} elseif (in_array($key, $this->images)) {
return null;
} elseif (in_array($key, $this->configs)) {
if (empty($data[$key])) {
return null;
}
$this->member->setConfig($this->tableToOpenPNE[$key], array_shift($data[$key]));
} else {
throw new BadMethodCallException(sprintf('Unknown method %s::%s', get_class($this), $name));
}
} else {
throw new BadMethodCallException(sprintf('Unknown method %s::%s', get_class($this), $name));
}
}
示例10: validate
public function validate($validator, $values, $arguments = array())
{
if (opToolkit::isMobileEmailAddress($values['mail_address'])) {
$mailValidator = new sfValidatorMobileEmail();
$values['mobile_address'] = $mailValidator->clean($values['mail_address']);
$mode = 'mobile';
} else {
$mailValidator = new opValidatorPCEmail();
$values['pc_address'] = $mailValidator->clean($values['mail_address']);
$mode = 'pc';
}
if (!opToolkit::isEnabledRegistration($mode)) {
throw new sfValidatorError($validator, 'invalid');
}
if (!empty($values['mobile_address']) && !$this->validateAddress('mobile_address', $values['mobile_address'])) {
$this->doNotSend = true;
}
if (!empty($values['pc_address']) && !$this->validateAddress('pc_address', $values['pc_address'])) {
$this->doNotSend = true;
}
return $values;
}
示例11: sendConfirmMail
protected function sendConfirmMail($token, $to, $params = array())
{
$authMode = $this->getOption('authMode', null);
if (!$authMode) {
$authMode = sfContext::getInstance()->getUser()->getCurrentAuthMode();
}
$params = array('token' => $token, 'authMode' => $authMode, 'isMobile' => opToolkit::isMobileEmailAddress($to), 'name' => $this->getOption('invited') ? sfContext::getInstance()->getUser()->getMember()->getName() : null, 'message' => $this->getOption('invited') ? $this->getValue('message') : null, 'subject' => opConfig::get('sns_name') . '招待状');
sfOpenPNEMailSend::sendTemplateMail('requestRegisterURL', $to, opConfig::get('admin_mail_address'), $params);
}
示例12: sendMail
public function sendMail()
{
if ($this->doNotSend)
{
return null;
}
$address = '';
$member = $this->member;
if (!$member)
{
$member = Doctrine::getTable('Member')->createPre();
}
if ($this->getValue('pc_address'))
{
$address = $this->getValue('pc_address');
$member->setConfig('pc_address_pre', $address);
}
elseif ($this->getValue('mobile_address'))
{
$address = $this->getValue('mobile_address');
$member->setConfig('mobile_address_pre', $address);
}
$token = $member->generateRegisterToken();
$authMode = $this->getOption('authMode', null);
if (!$authMode)
{
$authMode = sfContext::getInstance()->getUser()->getCurrentAuthMode();
}
$member->setConfig('register_auth_mode', $authMode);
$params = array(
'token' => $token,
'authMode' => 'MailAddress',
'isMobile' => opToolkit::isMobileEmailAddress($address),
'subject' => opConfig::get('sns_name').'招待状',
);
opMailSend::sendTemplateMail('notifyRegisterURL', $address, opConfig::get('admin_mail_address'), $params);
}
示例13: save
protected function save($data)
{
$event = new sfEvent(null, 'op_csv.import_filter_data');
sfContext::getInstance()->getEventDispatcher()->filter($event, $data);
$fields = $event->getReturnValue();
$member = new Member();
$memberConfigs = array();
$memberProfiles = array();
foreach ($data as $key => $col) {
$field = $this->fields[$key];
if ($field['is_profile']) {
$validator = $field['validator'];
$memberProfiles[$field['name']] = $validator->clean($col);
continue;
} else {
switch ($field['name']) {
case "nickname":
$validator = new opValidatorString(array('max_length' => 64, 'trim' => true, 'required' => true));
$member->name = $validator->clean($col);
break;
case "mail_address":
$validator = new sfValidatorEmail(array('trim' => true, 'required' => true));
$address = $validator->clean($col);
if (opToolkit::isMobileEmailAddress($address)) {
$memberConfigs['mobile_address'] = $address;
}
$memberConfigs['pc_address'] = $address;
break;
case "pc_mail_address":
$validator = new sfValidatorEmail(array('trim' => true, 'required' => true));
$address = $validator->clean($col);
if (opToolkit::isMobileEmailAddress($address)) {
throw new opCsvPluginImportException("'pc_mail_address' is mobile address.");
}
$memberConfigs['pc_address'] = $address;
break;
case "mobile_mail_address":
$validator = new sfValidatorEmail(array('trim' => true, 'required' => true));
$address = $validator->clean($col);
if (!opToolkit::isMobileEmailAddress($address)) {
throw new opCsvPluginImportException("'mobile_mail_address' is not support mobile address.");
}
$memberConfigs['mobile_address'] = $address;
break;
case "password":
$validator = new sfValidatorPassword(array('trim' => true, 'required' => true));
$memberConfigs['password'] = $validator->clean($col);
break;
}
}
}
// check unique for member config
foreach ($this->uniqueMemberConfigFields as $name) {
if (isset($memberConfigs[$name]) && Doctrine::getTable('MemberConfig')->retrieveByNameAndValue($name, $memberConfigs[$name])) {
throw new opCsvPluginImportException("'" . $name . "' duplicated.");
}
}
$member->setIsActive(true);
$member->save();
foreach ($memberConfigs as $key => $value) {
$member->setConfig($key, $value);
}
foreach ($memberProfiles as $key => $value) {
$profile = $this->field[$key]['profile'];
}
}