This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/form-upload-progress' into develop
Close #3058
- Loading branch information
Showing
14 changed files
with
313 additions
and
329 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
library/Zend/Form/View/Helper/File/FormFileApcProgress.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace Zend\Form\View\Helper\File; | ||
|
||
/** | ||
* A view helper to render the hidden input with a Session progress id | ||
* for file uploads progress tracking. | ||
* | ||
* @category Zend | ||
* @package Zend_Form | ||
* @subpackage View | ||
*/ | ||
class FormFileApcProgress extends FormFileUploadProgress | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
protected function getName() | ||
{ | ||
return ini_get('apc.rfc1867_name'); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
library/Zend/Form/View/Helper/File/FormFileSessionProgress.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace Zend\Form\View\Helper\File; | ||
|
||
/** | ||
* A view helper to render the hidden input with a Session progress id | ||
* for file uploads progress tracking. | ||
* | ||
* @category Zend | ||
* @package Zend_Form | ||
* @subpackage View | ||
*/ | ||
class FormFileSessionProgress extends FormFileUploadProgress | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
protected function getName() | ||
{ | ||
return ini_get('session.upload_progress.name'); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
library/Zend/Form/View/Helper/File/FormFileUploadProgress.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Form | ||
*/ | ||
|
||
namespace Zend\Form\View\Helper\File; | ||
|
||
use Zend\Form\ElementInterface; | ||
use Zend\Form\View\Helper\FormInput; | ||
|
||
/** | ||
* A view helper to render the hidden input with a UploadProgress id | ||
* for file uploads progress tracking. | ||
* | ||
* @category Zend | ||
* @package Zend_Form | ||
* @subpackage View | ||
*/ | ||
class FormFileUploadProgress extends FormInput | ||
{ | ||
/** | ||
* Invoke helper as functor | ||
* | ||
* Proxies to {@link render()}. | ||
* | ||
* @param ElementInterface|null $element | ||
* @return string | ||
*/ | ||
public function __invoke(ElementInterface $element = null) | ||
{ | ||
return $this->renderHiddenId(); | ||
} | ||
|
||
/** | ||
* Render a hidden form <input> element with the progress id | ||
* | ||
* @return string | ||
*/ | ||
public function renderHiddenId() | ||
{ | ||
$attributes = array(); | ||
$attributes['id'] = 'progress_key'; | ||
$attributes['name'] = $this->getName(); | ||
$attributes['type'] = 'hidden'; | ||
$attributes['value'] = $this->getValue(); | ||
|
||
return sprintf( | ||
'<input %s%s', | ||
$this->createAttributesString($attributes), | ||
$this->getInlineClosingBracket() | ||
); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getName() | ||
{ | ||
return 'UPLOAD_IDENTIFIER'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getValue() | ||
{ | ||
return uniqid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.