本文整理汇总了PHP中ProjectConfiguration::getApplicationName方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectConfiguration::getApplicationName方法的具体用法?PHP ProjectConfiguration::getApplicationName怎么用?PHP ProjectConfiguration::getApplicationName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::getApplicationName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
}
示例3: prepare
protected function prepare($user_id)
{
$this->app_name = ProjectConfiguration::getApplicationName();
$this->user = sfGuardUserTable::getInstance()->find($user_id);
if (!$this->user) {
throw new sfException('Cannot find User identified by ' . $user_id);
}
$this->name = $this->user->getPreferredName() ? $this->user->getPreferredName() : $this->user->getFullName();
}
示例4: configure
protected function configure()
{
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'test'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'pressure-test';
$this->briefDescription = '';
$this->detailedDescription = <<<EOF
The [{$namespace}:pressure-test|INFO] task attempts to fill the database with tons
of data to speed things up. Call it with:
[php symfony {$namespace}:pressure-test|INFO]
EOF;
}
示例5: configure
protected function configure()
{
$this->addArguments(array(new sfCommandArgument('domain', sfCommandArgument::REQUIRED, 'The subreddit domain.')));
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'api_v1'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'create-default-deadlines';
$this->briefDescription = '';
$this->detailedDescription = <<<EOF
The [{$namespace}:create-default-deadlines|INFO] task creates a set of deadlines for a subreddit if that subreddit has no current deadlines.
Call it with:
[php symfony {$namespace}:create-default-deadlines|INFO]
EOF;
}
示例6: configure
protected function configure()
{
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'cleanup-files';
$this->briefDescription = 'Remove old API info from the database';
$this->detailedDescription = <<<EOF
The [{$namespace}:cleanup-files|INFO] task removes old files from the app.
It's recommended to run this task at least once a day and no more than once
every fifteen minutes. Best for starting would be once every six hours.
Call it with:
[php symfony {$namespace}:cleanup-files|INFO]
EOF;
}
示例7: configure
protected function configure()
{
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'email-reminders';
$this->briefDescription = 'Emails reminders for users to validate';
$this->detailedDescription = <<<EOF
The [{$namespace}:email-reminders|INFO] task emails reminders for users to validate
their Reddit usernames.
It's recommended to run this task once a day. Seriously, more than that will
result in multiple emails. Don't do that.
Call it with:
[php symfony {$namespace}:email-reminders|INFO]
EOF;
}
示例8: configure
protected function configure()
{
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'), new sfCommandOption('subreddit', null, sfCommandOption::PARAMETER_OPTIONAL, 'An alternate subreddit location', ProjectConfiguration::getDefaultSubredditAddress())));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'validate-users';
$this->briefDescription = 'Validates users against keys taken from subreddits';
$this->detailedDescription = <<<EOF
The [{$namespace}:validate-users|INFO] task downloads a collection of validation
keys from a subreddit to validate usernames.
It's recommended to run this task at least once a day and no more than once
every fifteen minutes. Best for starting would be once every two hours.
Call it with:
[php symfony {$namespace}:validate-users|INFO]
EOF;
}
示例9: 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');
}
示例10: configure
protected function configure()
{
$this->addArguments(array(new sfCommandArgument('subreddit', sfCommandArgument::OPTIONAL, 'The name of any specific subreddit', '%')));
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'advance-episodes';
$this->briefDescription = 'Advances EpisodeAssignments';
$this->detailedDescription = <<<EOF
The [{$namespace}:advance-episodes|INFO] task runs the "engine" of the app by
advancing currenlt Episodes according to the rules defined by their subreddit
admins. It is also responsible for alerting users of when their connection with
an Episode is valid.
It's recommended to run this task at least once a day and no more than once
every half-hour. Best for starting would be once every two hours.
Call it with:
[php symfony {$namespace}:advance-episodes|INFO]
EOF;
}
示例11: configure
protected function configure()
{
$this->addArguments(array(new sfCommandArgument('subreddit', sfCommandArgument::OPTIONAL, 'The name of any specific subreddit', '%')));
$this->addOptions(array(new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'api_v1'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine')));
$this->namespace = str_replace(' ', '-', strtolower(ProjectConfiguration::getApplicationName()));
$namespace = $this->namespace;
$this->name = 'create-episodes';
$this->briefDescription = 'Generates Episodes for all Subreddits without future Episodes.';
$this->detailedDescription = <<<EOF
The [{$namespace}:create-episodes|INFO] task generates empty Episode objects for
those Subreddits not having any future Episodes. Calling with with a specific
Subreddit name will generate Episode objects for only that Subreddit, assuming
that it does not have future Episodes.
It's recommended to run this task at least once a day and no more than once
every half-hour. Best for starting would be once every two hours.
Call it with:
[php symfony {$namespace}:create-episodes ]
EOF;
}
示例12: sendUsingZendMail
protected static function sendUsingZendMail($transport = null)
{
ProjectConfiguration::registerZend();
$mail = new Zend_Mail();
$mail->addHeader('X-MailGenerator', ProjectConfiguration::getApplicationName());
$mail->setBodyText(self::$_message);
$mail->setBodyHtml(self::$_html_message);
$mail->setFrom(self::$_from);
if (is_array(self::$_to)) {
foreach (self::$_to as $send_to) {
$mail->addTo($send_to);
}
} else {
$mail->addTo(self::$_to);
}
$mail->setSubject(self::$_subject);
if (sfConfig::get('sf_environment') != 'prod') {
if (sfConfig::get('sf_logging_enabled')) {
sfContext::getInstance()->getLogger()->info('Mail sent: ' . $mail->getBodyText()->getRawContent());
}
return false;
}
return $mail->send($transport);
}
示例13: link_to
:</p>
<ul>
<li>Comedy routines</li>
<li>Scholarly panels, debates, and presentations</li>
<li>Independent music</li>
<li>And tons of people expressing themselves.</li>
</ul>
<p>Please <?php
echo link_to('register', '@sf_guard_register');
?>
and
<?php
echo link_to('sign in', '@sf_guard_signin');
?>
to participate!</p>
</div>
<div class="clear_columns"> </div>
<div id="home_page_alert">
<h3>We are in Beta</h3>
<p>This is the beta version of
<?php
echo ProjectConfiguration::getApplicationName();
?>
. I can't vouch for
performance issues, and it's currently hosted on my own Linux node server.
I'd like to move everything to Amazon, but first I'd just like to get things
moving. Please register your user and begin sharing episodes. However, be
aware that we probably won't be moving old episodes from this beta version
to the upcoming release, so hold onto your episodes in case you need to
re-release them again.</p>
</div>
示例14: 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);
}
示例15: getPanelTitle
public function getPanelTitle()
{
return ProjectConfiguration::getApplicationName() . " API Calls";
}