本文整理汇总了PHP中ProjectConfiguration::getEpisodeGraphicFileLocalDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectConfiguration::getEpisodeGraphicFileLocalDirectory方法的具体用法?PHP ProjectConfiguration::getEpisodeGraphicFileLocalDirectory怎么用?PHP ProjectConfiguration::getEpisodeGraphicFileLocalDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectConfiguration
的用法示例。
在下文中一共展示了ProjectConfiguration::getEpisodeGraphicFileLocalDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeUpload_image
public function executeUpload_image(sfWebRequest $request)
{
$id = $request->getParameter('id');
$filename = $request->getParameter('name');
$this->forward404Unless($id && $filename);
$valid_episode = $this->validateEpisodeForImageUpload($id, $filename);
$this->forward404Unless($valid_episode);
// Settings
$targetDir = rtrim(ProjectConfiguration::getEpisodeGraphicFileLocalDirectory(), '/');
//$targetDir = 'uploads/';
//$cleanupTargetDir = false; // Remove old files
//$maxFileAge = 60 * 60; // Temp file age in seconds
// 5 minutes execution time
@set_time_limit(5 * 60);
$fileName = $this->getUser()->getAttribute('valid_episode_image_file_hash', '');
return $this->handlePlupload($request, $targetDir, $fileName);
}
示例2: executeBackup
public function executeBackup(sfWebRequest $request)
{
$this->redirectUnless($this->getUser()->isAuthenticated() && $this->getUser()->getApiUserId(), '@sf_guard_signin');
$auth_key = $this->getUser()->getApiAuthKey();
$episode_data = Api::getInstance()->setUser($auth_key)->get('episode/' . $request->getParameter('id'), true);
$episode = ApiDoctrine::createObject('Episode', $episode_data['body']);
$quick_episode = ApiDoctrine::createQuickObject($episode_data['body']);
$this->forward404Unless($episode && $episode->getId());
$this->forward404Unless(strtotime($quick_episode->getReleaseDate()) >= time());
// If the episode is not released, only the admins and moderators can view it.
$permission = $this->verifyPermissionsForCurrentUser($quick_episode->getSubredditId(), array('admin'));
// Unless the owner of the episode is trying to edit it. That's okay.
$assignment_data = Api::getInstance()->setUser($auth_key)->get('episodeassignment/' . $quick_episode->getEpisodeAssignmentId(), true);
$assignment = ApiDoctrine::createQuickObject($assignment_data['body']);
$this->forward404Unless($permission || $assignment && $assignment->getSfGuardUserId() == $this->getUser()->getApiUserId());
$this->setLayout(false);
ProjectConfiguration::registerAws();
if ($request->getParameter('which') == 'graphic') {
$file_location = rtrim(ProjectConfiguration::getEpisodeGraphicFileLocalDirectory(), '/') . '/';
$filename = $episode->getGraphicFile();
if (file_exists($file_location . $filename)) {
$result = $episode->saveFileToApplicationBucket($file_location, $filename, 'upload', AmazonS3::ACL_PUBLIC);
if ($result->isOk()) {
unlink($file_location . $filename);
}
} else {
echo $file_location . $filename;
}
} elseif ($request->getParameter('which') == 'audio') {
$file_location = rtrim(ProjectConfiguration::getEpisodeAudioFileLocalDirectory(), '/') . '/';
$filename = $episode->getAudioFile();
if (file_exists($file_location . $filename)) {
$episode->saveFileToApplicationBucket($file_location, $filename, 'audio');
}
}
}
示例3: use_javascript
<?php
use_javascript(sfConfig::get('app_plupload_web_dir') . '/plupload.js');
use_javascript(sfConfig::get('app_plupload_web_dir') . '/plupload.html4.js');
use_javascript(sfConfig::get('app_plupload_web_dir') . '/plupload.html5.js');
use_javascript(sfConfig::get('app_plupload_web_dir') . '/plupload.flash.js');
$graphic_file_web_location = '/' . trim(str_replace(sfConfig::get('sf_web_dir'), '', ProjectConfiguration::getEpisodeGraphicFileLocalDirectory()), '/') . '/';
?>
<script type="text/javascript">
// Custom example logic
$(function() {
var uploader = new plupload.Uploader({
runtimes : 'html5, html4',
browse_button : 'graphic_pickfiles',
container : 'image_uploader',
max_file_size : '10mb',
chunk_size : '2mb',
unique_names : false,
url : '<?php
echo url_for('plupload/upload_image?id=' . $form->getObject()->getId());
?>
',
flash_swf_url : '<?php
echo image_path('plupload.flash.swf');
?>
',
filters : [
{title : "Images", extensions : "gif,jpg,jpeg,png"},
{title : "ISOs", extensions : "iso"},
],
示例4: 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);
}