本文整理汇总了PHP中__r函数的典型用法代码示例。如果您正苦于以下问题:PHP __r函数的具体用法?PHP __r怎么用?PHP __r使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__r函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifyDeletionByEmail
/**
* Notify the owner of the file passed as parameter that its file is going
* to be deleted
*
* @param App_Model_File $file
*/
private function notifyDeletionByEmail(App_Model_File $file)
{
try {
$mail = $this->createMail();
$subject = __r('[FileZ] Your file "%file_name%" is going to be deleted', array('file_name' => $file->file_name));
$msg = __r('email_delete_notif (%file_name%, %file_url%, %filez_url%, %available_until%)', array('file_name' => $file->file_name, 'file_url' => $file->getDownloadUrl(), 'filez_url' => url_for('/'), 'available_until' => $file->getAvailableUntil()->toString(Zend_Date::DATE_FULL)));
$mail->setBodyText($msg);
$mail->setSubject($subject);
$mail->addTo($file->uploader_email);
$mail->send();
fz_log('Delete notification sent to ' . $file->uploader_email, FZ_LOG_CRON);
} catch (Exception $e) {
fz_log('Can\'t send email to ' . $file->uploader_email . ' file_id:' . $file->id, FZ_LOG_CRON_ERROR);
}
}
示例2: emailAction
/**
* Share a file url by mail
*/
public function emailAction()
{
$this->secure();
$user = $this->getUser();
$file = $this->getFile();
$this->checkOwner($file, $user);
set('file', $file);
// Send mails
$user = $this->getUser();
$mail = $this->createMail();
$subject = __r('[FileZ] "%sender%" wants to share a file with you', array('sender' => $user['firstname'] . ' ' . $user['lastname']));
$msg = __r('email_share_file (%file_name%, %file_url%, %sender%, %msg%)', array('file_name' => $file->file_name, 'file_url' => $file->getDownloadUrl(), 'msg' => $_POST['msg'], 'sender' => $user['firstname'] . ' ' . $user['lastname']));
$mail->setBodyText($msg);
$mail->setSubject($subject);
$mail->setReplyTo($user['email'], $user['firstname'] . ' ' . $user['lastname']);
$mail->clearFrom();
$mail->setFrom($user['email'], $user['firstname'] . ' ' . $user['lastname']);
$emailValidator = new Zend_Validate_EmailAddress();
foreach (explode(' ', $_POST['to']) as $email) {
$email = trim($email);
if (empty($email)) {
continue;
}
if ($emailValidator->isValid($email)) {
$mail->addBcc($email);
} else {
$msg = __r('Email address "%email%" is incorrect, please correct it.', array('email' => $email));
return $this->returnError($msg, 'file/email.php');
}
}
try {
$mail->send();
return $this->returnSuccessOrRedirect('/');
} catch (Exception $e) {
fz_log('Error while sending email', FZ_LOG_ERROR, $e);
$msg = __('An error occured during email submission. Please try again.');
return $this->returnError($msg, 'file/email.php');
}
}
示例3: __r
echo $msg;
?>
</pre>
<?php
}
?>
</div>
<?php
}
?>
<?php
if (isset($fz_user)) {
?>
<p id="disk-usage"><?php
echo __r('Using %space% of %quota%', array('space' => '<b id="disk-usage-value">' . $fz_user->getDiskUsage() . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
?>
.
</p>
<?php
}
?>
<div id="support">
<?php
if (fz_config_get('looknfeel', 'help_url')) {
?>
<a href="<?php
echo url_for(fz_config_get('looknfeel', 'help_url'));
?>
" class="help" target="#_blank"><?php
示例4: __r
echo $file->getDownloadUrl();
?>
/view">
<img src="<?php
echo $file->getDownloadUrl();
?>
/view" class="preview-image" width="617px"/>
</a>
</p>
<?php
}
?>
<p id="availability">
<?php
echo __r('Available from %available_from% to %available_until%', array('available_from' => $file->getAvailableFrom()->toString(Zend_Date::DATE_LONG), 'available_until' => '<b>' . $file->getAvailableUntil()->toString(Zend_Date::DATE_LONG) . '</b>'));
?>
</p>
<p id="owner">
<?php
echo __('Uploaded by:');
?>
<b><?php
echo h($uploader);
?>
</b>
</p>
<?php
if ($file->comment) {
示例5: __r
echo $msg;
?>
</pre>
<?php
}
?>
</div>
<?php
}
?>
<?php
if (isset($fz_user)) {
?>
<p id="disk-usage"><?php
echo __r('Using %space% of %quota%', array('space' => '<b id="disk-usage-value">' . $fz_user->getDiskUsage() . '</b>', 'quota' => $fz_user->quota));
?>
.
</p>
<?php
}
?>
<div id="support">
<?php
if (fz_config_get('looknfeel', 'help_url')) {
?>
<a href="<?php
echo url_for(fz_config_get('looknfeel', 'help_url'));
?>
" class="help" target="#_blank"><?php
示例6: __r
echo $msg;
?>
</pre>
<?php
}
?>
</div>
<?php
}
?>
<?php
if (isset($user)) {
?>
<p id="disk-usage"><?php
echo __r('Using %space% of %quota%', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
?>
.
</p>
<?php
}
?>
<div id="support">
<?php
if (fz_config_get('looknfeel', 'help_url')) {
?>
<a href="<?php
echo url_for(fz_config_get('looknfeel', 'help_url'));
?>
" class="help" target="#_blank"><?php
示例7: onFileUploadError
/**
* Function called on file upload error. A message corresponding to the error
* code passed as parameter is return to the user. Error codes come from
* $_FILES['userfile']['error'] plus a custom error code called
* 'UPLOAD_ERR_QUOTA_EXCEEDED'
*
* @param integer $errorCode
*/
private function onFileUploadError($errorCode = null)
{
$response['status'] = 'error';
$response['statusText'] = __('An error occurred while uploading the file.') . ' ';
if ($errorCode === null) {
return $this->returnData($response);
}
switch ($errorCode) {
case UPLOAD_ERR_NO_TMP_DIR:
fz_log('upload error (Missing a temporary folder)', FZ_LOG_ERROR);
break;
case UPLOAD_ERR_CANT_WRITE:
fz_log('upload error (Failed to write file to disk)', FZ_LOG_ERROR);
break;
// These errors come from the client side, let him know what's wrong
// These errors come from the client side, let him know what's wrong
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$response['statusText'] .= __('The uploaded file exceeds the max file size.') . ' : (' . ini_get('upload_max_filesize') . ')';
break;
case UPLOAD_ERR_PARTIAL:
$response['statusText'] .= __('The uploaded file was only partially uploaded.');
break;
case UPLOAD_ERR_NO_FILE:
$response['statusText'] .= __('No file was uploaded.');
break;
case UPLOAD_ERR_QUOTA_EXCEEDED:
$response['statusText'] .= __r('You exceeded your disk space quota (%space%).', array('space' => fz_config_get('app', 'user_quota')));
case UPLOAD_ERR_ALLOWED_EXTS:
$response['statusText'] .= __r('The file is not allowed to be uploaded. Note that files allowed need to be %allowed_exts%.', array('allowed_exts' => fz_config_get('app', 'allowed_exts')));
}
return $this->returnData($response);
}
示例8: isValid
/**
* Function used to check if a new or updated user is valid
*
* @param $action the action is to update or to create a user. Value 'new' or 'update'.
* @return array (attribut => error message)
*/
public function isValid($action = 'new')
{
$return = array();
if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
$return['email'] = __r('"%s%" is not a valid email.', array('s' => $this->email));
}
if (null == $this->username) {
$return['username'] = __('The username should not be blank');
}
if (4 > strlen($this->password)) {
$return['password'] = __('The password is too short.');
}
if ('new' == $action) {
if ($this->getTable()->findByUsername($this->username) !== null) {
$return['username'] = __('This username is already used.');
}
if ($this->getTable()->findByEmail($this->email) !== null) {
$return['email'] = __('This email is already used.');
}
} elseif ('update' == $action) {
if (null != $this->getTable()->findByUsername($this->username) && params('id') != $this->getTable()->findByUsername($this->username)->getId()) {
$return['username'] = __('This username belongs to another user.');
}
if (null != $this->getTable()->findByEmail($this->email) && params('id') != $this->getTable()->findByEmail($this->email)->getId()) {
$return['email'] = __('This email belongs to another user.');
}
}
return $return;
}
示例9: h
} else {
?>
<?php
echo h($uploader['email']);
?>
<?php
}
?>
</p>
<p>
<?php
echo __('Availability');
?>
:
<?php
echo __r('between %available_from% and %available_until%', array('available_from' => $file->getAvailableFrom()->toString(Zend_Date::DATE_LONG), 'available_until' => $file->getAvailableUntil()->toString(Zend_Date::DATE_LONG)));
?>
</p>
<?php
if ($file->comment) {
?>
<p><?php
echo __('Comments');
?>
: <?php
echo h($file->comment);
?>
</p>
<?php
}
?>
示例10: create_link
function create_link($path, $name)
{
global $cwd, $useForce;
echo __g("Linking {$name}...");
try {
if (file_exists($path)) {
if (!file_exists(HOME . DS . $path) || $useForce) {
if (file_exists(HOME . DS . $path)) {
$new_name = HOME . DS . $path . ".bak_dotfiles_installer";
while (file_exists($new_name)) {
$new_name .= ".copy";
}
rename(HOME . DS . $path, $new_name);
}
symlink($cwd . DS . $path, HOME . DS . $path);
echo __g("DONE\n");
} else {
throw new RuntimeException("{$name} files already exist");
}
} else {
throw new RuntimeException("{$name} files appear to be missing");
}
} catch (RuntimeException $e) {
echo __r("FAIL (" . $e->getMessage() . ")\n");
}
}
示例11: __r
<h2><?php
echo __r('Do you really want to delete: %filename%?', array('filename' => '<span class="filename">' . h($file->file_name)));
?>
</span></h2>
<form method="post">
<p style="padding: 2em 0;">
<input type="submit" value="<?php
echo __('Yes, delete that file');
?>
" class="delete"/> |
<a href="#" onclick="javascript:history.go(-1); return false;"><?php
echo __('No, go back to previous page');
?>
</a>
</p>
</form>
示例12: url_for
<td>
<a href="<?php
echo url_for('/admin/users/' . $file->getUploader()->id);
?>
">
<?php
echo h($file->getUploader());
?>
(<?php
echo h($file->getUploader()->username);
?>
)
</a>
</td>
<td><?php
echo __r('from %from% to %to%', array('from' => $file->getAvailableFrom()->get(Zend_Date::MONTH) == $file->getAvailableUntil()->get(Zend_Date::MONTH) ? $file->getAvailableFrom()->toString('d') : $file->getAvailableFrom()->toString('d MMMM'), 'to' => '<b>' . $file->getAvailableUntil()->toString('d MMMM') . '</b>'));
?>
</td>
<td><?php
echo $file->getReadableFileSize();
?>
</td>
<td><?php
echo (int) $file->download_count;
?>
</td>
<td><a href="<?php
echo $file->getDownloadUrl() . '/delete';
?>
"><?php
echo __('Delete');
示例13: __
?>
/extend" class="extend" title="<?php
echo __('Extend one more day');
?>
">
<?php
echo __('Extend one more day');
?>
</a>
<?php
}
?>
</p>
<p class="download-counter">
<?php
echo $file->download_count == 0 ? __('Never downloaded') : ($file->download_count == 1 ? __('Downloaded once') : __r('Download %x% times', array('x' => (int) $file->download_count)));
// TODO ugly DIY plural ...
?>
</p>
<p class="delete">
<a href="<?php
echo $file->getDownloadUrl();
?>
/delete" class="delete" title="<?php
echo __('Delete');
?>
">
<?php
echo __('Delete');
?>
</a>
示例14: __
<h2><?php
echo __('Admin dashboard');
?>
</h2>
<?php
echo __r('Manage %NumberOfUsers% users</a> and %NumberOfFiles% files</a>.', array('NumberOfUsers' => '<a href="' . url_for('admin/users') . '">' . $numberOfUsers, 'NumberOfFiles' => '<a href="' . url_for('admin/files') . '">' . $numberOfFiles));
?>
(<?php
echo $totalDiskSpace;
?>
).
示例15: sendFileDownloadedMail
/**
* Notify the file's owner by email that its file has been downloaded
*
* @param App_Model_File $file
*/
private function sendFileDownloadedMail(App_Model_File $file)
{
if (!$file->notify_uploader) {
return;
}
// find user IP
// TODO: extract this function to generic place
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP']) {
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
} else {
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
if ($_SERVER['HTTP_X_FORWARDED']) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
} else {
if ($_SERVER['HTTP_FORWARDED_FOR']) {
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
} else {
if ($_SERVER['HTTP_FORWARDED']) {
$ipaddress = $_SERVER['HTTP_FORWARDED'];
} else {
if ($_SERVER['REMOTE_ADDR']) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
} else {
$ipaddress = 'UNKNOWN';
}
}
}
}
}
}
// Send confirmation mail
$user = Fz_Db::getTable('User')->findById($file->created_by);
// I don't get why $user = $this->getUser (); doesn't work ???
$mail = $this->createMail();
$mail->addTo($user->email);
$mail->addTo($user->email, $user->firstname . ' ' . $user->lastname);
$subject = __r('[FileZ] "%file_name%" downloaded', array('file_name' => $file->file_name));
$msg = __r('email_file_downloaded (%file_name%, %file_url%, %sender%, %ip%)', array('file_name' => $file->file_name, 'file_url' => $file->getDownloadUrl(), 'sender' => $user, 'ip' => $ipaddress));
$mail->setBodyText($msg);
$mail->setSubject($subject);
$mail->setReplyTo($user->email, $user);
$mail->clearFrom();
$mail->setFrom(fz_config_get('email', 'from_email'), fz_config_get('email', 'from_name'));
try {
$mail->send();
} catch (Exception $e) {
fz_log('Can\'t send email "File Downloaded" : ' . $e, FZ_LOG_ERROR);
}
}