当前位置: 首页>>代码示例>>PHP>>正文


PHP ProjectConfiguration::getApplicationEmailAddress方法代码示例

本文整理汇总了PHP中ProjectConfiguration::getApplicationEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectConfiguration::getApplicationEmailAddress方法的具体用法?PHP ProjectConfiguration::getApplicationEmailAddress怎么用?PHP ProjectConfiguration::getApplicationEmailAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectConfiguration的用法示例。


在下文中一共展示了ProjectConfiguration::getApplicationEmailAddress方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(Doctrine_Connection $conn = null)
 {
     $send_message = false;
     if ($this->isNew()) {
         if (!$this->hasVerifiedSender()) {
             $this->deleteWithException("Cannot create Message " . "because sfGuardUser " . $this->getSenderId() . " has not been validated yet.", 406);
         }
         if (!$this->hasVerifiedRecipient()) {
             $this->deleteWithException("Cannot create Message " . "because sfGuardUser " . $this->getSenderId() . " has not been validated yet.", 406);
         }
         $send_message = true;
     }
     /* If the obejct is not new or has passed all rules for saving, we pass
      * it on to the parent save function.
      */
     parent::save($conn);
     if ($send_message) {
         /* The following is for sending an email to the recipient to notify them that they've received a message.
          */
         $recipient = sfGuardUserTable::getInstance()->find($this->getRecipientId());
         if (!$recipient || !$recipient->getReceiveNotificationOfPrivateMessages()) {
             return parent::save($conn);
         }
         $parameters = array('user_id' => $this->getRecipientId(), 'message_id' => $this->getIncremented());
         $prefer_html = $recipient->getPreferHtml();
         $address = $recipient->getEmailAddress();
         $name = $recipient->getPreferredName() ? $recipient->getPreferredName() : $recipient->getFullName();
         $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage('NewPrivateMessage', $recipient->getPreferredLanguage());
         $subject = $email->generateSubject($parameters);
         $body = $email->generateBodyText($parameters, $prefer_html);
         $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
         AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:34,代码来源:Message.class.php

示例2: save

 public function save(Doctrine_Connection $conn = null)
 {
     if (is_null($this->_get('username')) && is_null($this->_get('email_address'))) {
         return;
         //throw new sfException('Cannot save User with null username and email!');
     }
     if ($this->isNew() && sfGuardUserTable::getIfValidatedUserHasUsername($this->_get('username'))) {
         throw new sfException('Cannot save user.  This username has already been validated with another user.');
     }
     if (!$this->isNew() && in_array('is_validated', $this->_modified) && !$this->_get('is_validated')) {
         /* The user has been un-validated, probably due to changing their
          * Reddit validation key by username or password.  We need to send
          * them an email about it.
          */
         $parameters = array('user_id' => $this->getIncremented());
         $prefer_html = $this->getPreferHtml();
         $address = $this->getEmailAddress();
         $name = $this->getPreferredName() ? $this->getPreferredName() : $this->getFullName();
         $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage('ChangeRedditKey', $this->getPreferredLanguage());
         $subject = $email->generateSubject($parameters);
         $body = $email->generateBodyText($parameters, $prefer_html);
         $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
         AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
         $this->addLoginMessage('You have changed information relating to your Reddit user and will need to validate your Reddit username again.  Please see your email for more information.');
     }
     parent::save($conn);
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:27,代码来源:sfGuardUser.class.php

示例3: executeSend

 public function executeSend(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post'));
     if ($this->getUser()->getApiUserId()) {
         sfConfig::set('app_recaptcha_active', false);
     }
     $this->form = new FeedbackForm();
     if ($this->getUser()->getApiUserId()) {
         unset($this->form['name']);
         unset($this->form['email']);
     }
     $requestData = $request->getParameter($this->form->getName());
     if (sfConfig::get('app_recaptcha_active', false)) {
         $requestData['challenge'] = $this->getRequestParameter('recaptcha_challenge_field');
         $requestData['response'] = $this->getRequestParameter('recaptcha_response_field');
     }
     $this->form->bind($requestData);
     if ($this->form->isValid()) {
         if ($this->getUser()->getApiUserId()) {
             $user_data = Api::getInstance()->get('user/' . $this->getUser()->getApiUserId(), true);
             $user = ApiDoctrine::createQuickObject($user_data['body']);
         } else {
             $user = null;
         }
         $values = $this->form->getValues();
         $name = $this->getUser()->getApiUserId() ? $user->getPreferredName() ? $user->getPreferredName() : $user->getFullName() : $this->form->getValue('name');
         $email = $this->getUser()->getApiUserId() ? $user->getEmailAddress() : $this->form->getValue('email');
         $signinUrl = $this->getUser()->getReferer($request->getReferer());
         $message = $name . ' ' . $email . "\n" . $values['message'] . "\nReferer:" . $signinUrl;
         $to = ProjectConfiguration::getApplicationFeedbackAddress();
         $subjects = sfConfig::get('app_feedback_subjects', array());
         $subject = ProjectConfiguration::getApplicationName() . ': ' . (array_key_exists($values['subject'], $subjects) ? $subjects[$values['subject']] : $values['subject']);
         $from_address = $this->getUser()->getApiUserId() ? "{$name} <{$email}>" : ProjectConfiguration::getApplicationEmailAddress();
         AppMail::sendMail($to, $from_address, $subject, $message);
         $this->getUser()->setFlash('notice', 'Your message has been sent to ' . ProjectConfiguration::getApplicationName() . '.');
         return $this->redirect('' != $signinUrl ? $signinUrl : '@homepage');
     }
     $this->getUser()->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer());
     $this->setTemplate('feedback');
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:40,代码来源:actions.class.php

示例4: sendMail

 public function sendMail($body_function, $additional_params = array())
 {
     $user = $this->getGuardUser();
     if (!$user) {
         return;
     }
     if (!$user->getReceiveNotificationOfEpisodeApprovalPending() && $body_function == "EpisodeApprovalPending") {
         return;
     }
     if (!$user->getReceiveNotificationOfNewlyOpenedEpisodes() && $body_function == "NewlyOpenedEpisode") {
         return;
     }
     if (!$user->getReceiveNotificationOfPrivateMessages() && $body_function == "NewPrivateMessage") {
         return;
     }
     $prefer_html = $user->getPreferHtml();
     $address = $user->getEmailAddress();
     $name = $user->getPreferredName() ? $user->getPreferredName() : $user->getFullName();
     $user_id = $this->getApiUserId();
     if (!array_key_exists('user_id', $additional_params)) {
         $additional_params['user_id'] = $user_id;
     }
     if (array_key_exists('language', $additional_params)) {
         $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage($body_function, $additional_params['language']);
     } else {
         $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage($body_function);
     }
     if (!$email) {
         throw new sfException("Cannot find email '{$body_function}' in language '{$language}'.");
     }
     $subject = $email->generateSubject($additional_params);
     $body = $email->generateBodyText($additional_params, $prefer_html);
     $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
     return AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:35,代码来源:myUser.class.php

示例5: sendEmailAboutPassedDeadline

 public function sendEmailAboutPassedDeadline($user_id, $episode_id)
 {
     // Send an email to that user telling them their EpisodeAssignment is now valid
     $parameters = array('user_id' => $user_id, 'episode_id' => $episode_id);
     $user = sfGuardUserTable::getInstance()->find($user_id);
     $prefer_html = $user->getPreferHtml();
     $address = $user->getEmailAddress();
     $name = $user->getPreferredName() ? $user->getPreferredName() : $user->getFullName();
     $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage('PassedDeadlineOnEpisode', $user->getPreferredLanguage());
     $subject = $email->generateSubject($parameters);
     $body = $email->generateBodyText($parameters, $prefer_html);
     $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
     AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
     $user->addLoginMessage('Your episode passed its release deadline and has been re-assigned.');
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:15,代码来源:SubredditTable.class.php

示例6: save

 public function save(Doctrine_Connection $conn = null)
 {
     if (!$this->isNew() && !$this->getSkipBackup() && in_array('graphic_file', $this->_modified) && $this->_get('graphic_file')) {
         $file_location = rtrim(ProjectConfiguration::getEpisodeGraphicFileLocalDirectory(), '/') . '/';
         $filename = $this->_get('graphic_file');
         if (file_exists($file_location . $filename)) {
             ProjectConfiguration::registerAws();
             $response = $this->saveFileToApplicationBucket($file_location, $filename, 'upload', AmazonS3::ACL_PUBLIC);
             if ($response->isOK()) {
                 unlink($file_location . $filename);
             }
         }
     }
     if (!$this->isNew() && !$this->getSkipBackup() && in_array('audio_file', $this->_modified) && $this->_get('audio_file')) {
         $file_location = rtrim(ProjectConfiguration::getEpisodeAudioFileLocalDirectory(), '/') . '/';
         $filename = $this->_get('audio_file');
         if (file_exists($file_location . $filename)) {
             ProjectConfiguration::registerAws();
             $response = $this->saveFileToApplicationBucket($file_location, $filename, 'audio');
         }
     }
     if (!$this->isNew() && in_array('is_submitted', $this->_modified) && $this->_get('is_submitted')) {
         /* The episode has been submitted.  We need to send an email about
          * it to the subreddit moderators.
          */
         $types = array('moderator');
         $memberships = sfGuardUserSubredditMembershipTable::getInstance()->getAllBySubredditAndMemberships($this->getSubredditId(), $types);
         $initial_is_submitted = $this->_get('is_submitted');
         $initial_submitted_at = $this->_get('submitted_at');
         foreach ($memberships as $membership) {
             $user = $membership->getSfGuardUser();
             $parameters = array('user_id' => $membership->getSfGuardUserId(), 'episode_id' => $this->getIncremented());
             $prefer_html = $user->getPreferHtml();
             $address = $user->getEmailAddress();
             $name = $user->getPreferredName() ? $user->getPreferredName() : $user->getFullName();
             $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage('EpisodeApprovalPending', $user->getPreferredLanguage());
             $subject = $email->generateSubject($parameters);
             $body = $email->generateBodyText($parameters, $prefer_html);
             $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
             AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
             $user->addLoginMessage('You have Episodes awaiting your approval.');
         }
         // @todo: The previous foreach loop sets the 'is_submitted' and 'submitted_at' columns to null.  I don't know why.
         $this->_set('is_submitted', $initial_is_submitted);
         $this->_set('submitted_at', $initial_submitted_at);
     }
     return parent::save($conn);
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:48,代码来源:Episode.class.php

示例7: produceAtom

 protected function produceAtom($feedArray)
 {
     // Atom 1.0
     $doc = new DomDocument('1.0', 'utf-8');
     $feed = $doc->createElement('feed');
     $feed->setAttribute('xmlns:itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
     $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
     $feed->setAttribute('xml:lang', $feedArray['language']);
     $doc->appendChild($feed);
     $title = $doc->createElement('title', $feedArray['title']);
     $title->setAttribute('type', 'text');
     $subtitle = $doc->createElement('subtitle', $feedArray['description']);
     $subtitle->setAttribute('type', 'text');
     $updated = $doc->createElement('updated', date('Y-m-d\\TH:i:sP'));
     $generator = $doc->createElement('generator', ProjectConfiguration::getApplicationName() . ' Feed Module');
     $link_alternate = $doc->createElement('link');
     $link_alternate->setAttribute('rel', 'alternate');
     $link_alternate->setAttribute('type', 'text/html');
     $link_alternate->setAttribute('href', $feedArray['link']);
     $link_self = $doc->createElement('link');
     $link_self->setAttribute('rel', 'self');
     $link_self->setAttribute('type', 'application/atom+xml');
     $link_self->setAttribute('href', $feedArray['atom_link']);
     $id = $doc->createElement('id', $feedArray['link']);
     $author = $doc->createElement('author');
     $a_name = $doc->createElement('name', ProjectConfiguration::getApplicationName());
     $a_email = $doc->createElement('email', ProjectConfiguration::getApplicationEmailAddress());
     $a_uri = $doc->createElement('uri', $this->getController()->genUrl('@homepage', true));
     $author->appendChild($a_name);
     $author->appendChild($a_email);
     $author->appendChild($a_uri);
     $feed->appendChild($title);
     $feed->appendChild($subtitle);
     $feed->appendChild($updated);
     $feed->appendChild($generator);
     $feed->appendChild($link_alternate);
     $feed->appendChild($link_self);
     $feed->appendChild($id);
     $feed->appendChild($author);
     $itunes_explicit = $doc->createElement('itunes:explicit', $feedArray["is_nsfw"]);
     $itunes_summary = $doc->createElement('itunes:summary', substr($feedArray['description'], 0, 3999));
     $itunes_category = $doc->createElement('itunes:category');
     $itunes_category->setAttribute('text', 'Technology');
     $itunes_subcategory = $doc->createElement('itunes:category');
     $itunes_subcategory->setAttribute('text', 'Podcasting');
     $itunes_category->appendChild($itunes_subcategory);
     // Including the itunes:owner messes with the feed by overriding the title in iTunes.
     $feed->appendChild($itunes_explicit);
     $feed->appendChild($itunes_summary);
     $feed->appendChild($itunes_category);
     foreach ($feedArray['entries'] as $entry) {
         $fentry = $doc->createElement('entry');
         //$fentry->setAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
         $e_title = $doc->createElement('title');
         $e_title->setAttribute('type', 'html');
         $cdata_title = $doc->createCDATASection($entry['title']);
         $e_title->appendChild($cdata_title);
         $thumbnail_tag = $entry['thumbnail'] ? '<p><img src="' . $entry['thumbnail'] . '"/></p>' : '';
         $e_summary = $doc->createElement('summary');
         $e_summary->setAttribute('type', 'html');
         $cdata_summary = $doc->createCDATASection($thumbnail_tag . substr($entry['description'], 0, 500));
         $e_summary->appendChild($cdata_summary);
         $e_published = $doc->createElement('published', date('Y-m-d\\TH:i:sP', $entry['released']));
         $e_updated = $doc->createElement('updated', date('Y-m-d\\TH:i:sP', $entry['modified'] > $entry['released'] ? $entry['modified'] : $entry['released']));
         $e_link = $doc->createElement('link');
         $e_link->setAttribute('rel', 'alternate');
         $e_link->setAttribute('type', 'text/html');
         $e_link->setAttribute('href', $entry['link']);
         $e_id = $doc->createElement('id', $entry['link']);
         $e_author = $doc->createElement('author');
         $ea_name = $doc->createElement('name', $entry['author']['name']);
         $e_author->appendChild($ea_name);
         $e_enclosure = $doc->createElement('link');
         $e_enclosure->setAttribute('rel', 'enclosure');
         $audio_info = $this->getRemoteInfo($entry['audio_location']);
         $e_enclosure->setAttribute('type', $audio_info['type']);
         $e_enclosure->setAttribute('href', $entry['audio_location']);
         $e_enclosure->setAttribute('length', $audio_info['length']);
         $e_enclosure->setAttribute('title', 'Audio');
         $e_content = $doc->createElement('content');
         //$e_content->setAttribute('xmlns:xhtml',
         //                         'http://www.w3.org/1999/xhtml');
         $e_content->setAttribute('type', 'xhtml');
         $fragment = $doc->createDocumentFragment();
         $fragment->appendXML($thumbnail_tag . $entry['content']);
         $e_div = $doc->createElement('div');
         $e_div->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
         $e_div->appendChild($fragment);
         $e_content->appendChild($e_div);
         if ($entry['reddit_post_url']) {
             $e_comments = $doc->createElement('link');
             $e_comments->setAttribute('rel', 'replies');
             $e_comments->setAttribute('type', 'text/html');
             $e_comments->setAttribute('href', $entry['reddit_post_url']);
         }
         $fentry->appendChild($e_title);
         $fentry->appendChild($e_summary);
         $fentry->appendChild($e_published);
         $fentry->appendChild($e_updated);
         $fentry->appendChild($e_link);
//.........这里部分代码省略.........
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:101,代码来源:actions.class.php


注:本文中的ProjectConfiguration::getApplicationEmailAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。