Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[Demos] Update code to ZF2 Beta5 API #1834

Merged
merged 1 commit into from

3 participants

@Maks3w
Collaborator

Feed: Tested and functional
ProgressBar: JsPush: OK, Upload: Not tested, ZendForm: Needs refactor
LiveDocx: Not tested
Amazon: Tested, fail with error 400
Flickr: Search works, composite: null
XmlRpc: Tested and functional

@travisbot

This pull request passes (merged 1a90d91 into a4d6ece).

@weierophinney weierophinney merged commit 1a90d91 into zendframework:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 10, 2012
  1. @Maks3w
This page is out of date. Refresh to see the latest.
Showing with 291 additions and 394 deletions.
  1. +8 −20 demos/Zend/Feeds/consume-feed.php
  2. +23 −33 demos/Zend/ProgressBar/JsPush.php
  3. +34 −44 demos/Zend/ProgressBar/Upload.php
  4. +46 −58 demos/Zend/ProgressBar/ZendForm.php
  5. +16 −22 demos/Zend/{WebServices → Service}/Amazon/amazon-search.php
  6. +15 −23 demos/Zend/{WebServices → Service}/Flickr/flickr-composite.php
  7. +33 −0 demos/Zend/Service/Flickr/flickr-search.php
  8. +1 −0  demos/Zend/Service/LiveDocx/.gitignore
  9. +2 −6 demos/Zend/Service/LiveDocx/Bootstrap.php
  10. +6 −18 demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist
  11. +5 −4 demos/Zend/Service/LiveDocx/MailMerge/bitmaps/generate-bitmaps.php
  12. +4 −3 demos/Zend/Service/LiveDocx/MailMerge/conference-pass/generate-document.php
  13. +9 −11 demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php
  14. +5 −4 demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document.php
  15. +6 −5 demos/Zend/Service/LiveDocx/MailMerge/metafiles/generate-metafiles.php
  16. +5 −4 demos/Zend/Service/LiveDocx/MailMerge/pdf-security/generate-document.php
  17. +11 −14 demos/Zend/Service/LiveDocx/MailMerge/supported-fonts/show-supported-fonts-cached.php
  18. +11 −14 demos/Zend/Service/LiveDocx/MailMerge/supported-formats/show-supported-formats-cached.php
  19. +5 −5 demos/Zend/Service/LiveDocx/MailMerge/telephone-bill/generate-document.php
  20. +15 −31 demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php
  21. +0 −41 demos/Zend/WebServices/Flickr/flickr-search.php
  22. +0 −31 demos/Zend/WebServices/Protocols/xmlrpc-upc-lookup.php
  23. +28 −0 demos/Zend/XmlRpc/xmlrpc-upc-lookup.php
  24. +1 −1  library/Zend/ProgressBar/ProgressBar.php
  25. +1 −1  library/Zend/Registry.php
  26. +1 −1  library/Zend/Service/LiveDocx/MailMerge.php
View
28 demos/Zend/Feeds/consume-feed.php
@@ -1,22 +1,11 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Feed
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_Feed
*/
use Zend\Loader\StandardAutoloader;
@@ -28,14 +17,13 @@
*/
require_once dirname(dirname(dirname(__DIR__))).'/library/Zend/Loader/StandardAutoloader.php';
-$loader = new StandardAutoloader;
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
$rss = Reader::import('http://news.google.com/?output=rss');
foreach ($rss as $item) {
-
- echo "<p>" . $item->getTitle() . "<br />", "\n";
- echo $item->getLink() . "</p>";
+ echo '<p>' . $item->getTitle() . '<br />', "\n";
+ echo $item->getLink() . '</p>';
}
View
56 demos/Zend/ProgressBar/JsPush.php
@@ -1,45 +1,36 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_ProgressBar
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_ProgressBar
*/
+use Zend\Loader\StandardAutoloader;
+use Zend\ProgressBar\Adapter\JsPush;
+use Zend\ProgressBar\ProgressBar;
+
/**
* This sample file demonstrates a simple use case of a jspush-driven progressbar
*/
if (isset($_GET['progress'])) {
- set_include_path(realpath(__DIR__ . '/../../../library')
- . PATH_SEPARATOR . get_include_path());
+ require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
+ $loader = new StandardAutoloader(array('autoregister_zf' => true));
+ $loader->register();
- require_once 'Zend/ProgressBar.php';
- require_once 'Zend/ProgressBar/Adapter/JsPush.php';
-
- $adapter = new Zend_ProgressBar_Adapter_JsPush(array('updateMethodName' => 'Zend_ProgressBar_Update',
- 'finishMethodName' => 'Zend_ProgressBar_Finish'));
- $progressBar = new Zend_ProgressBar($adapter, 0, 100);
+ $adapter = new JsPush(array('updateMethodName' => 'Zend_ProgressBar_Update',
+ 'finishMethodName' => 'Zend_ProgressBar_Finish'));
+ $progressBar = new ProgressBar($adapter, 0, 100);
for ($i = 1; $i <= 100; $i++) {
if ($i < 20) {
$text = 'Just beginning';
- } else if ($i < 50) {
+ } elseif ($i < 50) {
$text = 'A bit done';
- } else if ($i < 80) {
+ } elseif ($i < 80) {
$text = 'Getting closer';
} else {
$text = 'Nearly done';
@@ -126,23 +117,20 @@
}
</style>
<script type="text/javascript">
- function startProgress()
- {
+ function startProgress() {
var iFrame = document.createElement('iframe');
document.getElementsByTagName('body')[0].appendChild(iFrame);
iFrame.src = 'JsPush.php?progress';
}
- function Zend_ProgressBar_Update(data)
- {
+ function Zend_ProgressBar_Update(data) {
document.getElementById('pg-percent').style.width = data.percent + '%';
document.getElementById('pg-text-1').innerHTML = data.text;
document.getElementById('pg-text-2').innerHTML = data.text;
}
- function Zend_ProgressBar_Finish()
- {
+ function Zend_ProgressBar_Finish() {
document.getElementById('pg-percent').style.width = '100%';
document.getElementById('pg-text-1').innerHTML = 'Demo done';
@@ -160,6 +148,8 @@ function Zend_ProgressBar_Finish()
<div class="pg-text" id="pg-text-2"></div>
</div>
</div>
- <div id="progressBar"><div id="progressDone"></div></div>
+ <div id="progressBar">
+ <div id="progressDone"></div>
+ </div>
</body>
</html>
View
78 demos/Zend/ProgressBar/Upload.php
@@ -1,42 +1,32 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_ProgressBar
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_ProgressBar
*/
+use Zend\Loader\StandardAutoloader;
+use Zend\ProgressBar\Adapter\JsPull;
+use Zend\ProgressBar\ProgressBar;
+
/**
* This sample file demonstrates a simple use case of a jspull-driven progressbar
*/
if (isset($_GET['uploadId'])) {
- set_include_path(realpath(__DIR__ . '/../../../library')
- . PATH_SEPARATOR . get_include_path());
-
- require_once 'Zend/ProgressBar.php';
- require_once 'Zend/ProgressBar/Adapter/JsPull.php';
- require_once 'Zend/Session/Namespace.php';
+ require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
+ $loader = new StandardAutoloader(array('autoregister_zf' => true));
+ $loader->register();
$data = uploadprogress_get_info($_GET['uploadId']);
$bytesTotal = ($data === null ? 0 : $data['bytes_total']);
$bytesUploaded = ($data === null ? 0 : $data['bytes_uploaded']);
- $adapter = new Zend_ProgressBar_Adapter_JsPull();
- $progressBar = new Zend_ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
+ $adapter = new JsPull();
+ $progressBar = new ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
if ($bytesTotal === $bytesUploaded) {
$progressBar->finish();
@@ -117,8 +107,7 @@
}
</style>
<script type="text/javascript">
- function makeRequest(url)
- {
+ function makeRequest(url) {
var httpRequest;
if (window.XMLHttpRequest) {
@@ -132,7 +121,8 @@ function makeRequest(url)
} catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {}
+ } catch (e) {
+ }
}
}
@@ -141,24 +131,23 @@ function makeRequest(url)
return false;
}
- httpRequest.onreadystatechange = function() { evalProgress(httpRequest); };
+ httpRequest.onreadystatechange = function () {
+ evalProgress(httpRequest);
+ };
httpRequest.open('GET', url, true);
httpRequest.send('');
}
- function observeProgress()
- {
+ function observeProgress() {
setTimeout("getProgress()", 1500);
}
- function getProgress()
- {
+ function getProgress() {
makeRequest('Upload.php?uploadId=' + document.getElementById('uploadId').value);
}
- function evalProgress(httpRequest)
- {
+ function evalProgress(httpRequest) {
try {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
@@ -174,21 +163,19 @@ function evalProgress(httpRequest)
alert('There was a problem with the request.');
}
}
- } catch(e) {
+ } catch (e) {
alert('Caught Exception: ' + e.description);
}
}
- function update(data)
- {
+ function update(data) {
document.getElementById('pg-percent').style.width = data.percent + '%';
document.getElementById('pg-text-1').innerHTML = data.timeRemaining + ' seconds remaining';
document.getElementById('pg-text-2').innerHTML = data.timeRemaining + ' seconds remaining';
}
- function finish()
- {
+ function finish() {
document.getElementById('pg-percent').style.width = '100%';
document.getElementById('pg-text-1').innerHTML = 'Upload done';
@@ -197,10 +184,11 @@ function finish()
</script>
</head>
<body>
- <form enctype="multipart/form-data" method="post" action="Upload.php" target="uploadTarget" onsubmit="observeProgress();">
- <input type="hidden" name="UPLOAD_IDENTIFIER" id="uploadId" value="<?php echo md5(uniqid(rand())); ?>" />
- <input type="file" name="file" />
- <input type="submit" value="Upload!" />
+ <form enctype="multipart/form-data" method="post" action="Upload.php" target="uploadTarget"
+ onsubmit="observeProgress();">
+ <input type="hidden" name="UPLOAD_IDENTIFIER" id="uploadId" value="<?php echo md5(uniqid(rand())); ?>"/>
+ <input type="file" name="file"/>
+ <input type="submit" value="Upload!"/>
</form>
<iframe name="uploadTarget"></iframe>
@@ -213,6 +201,8 @@ function finish()
<div class="pg-text" id="pg-text-2"></div>
</div>
</div>
- <div id="progressBar"><div id="progressDone"></div></div>
+ <div id="progressBar">
+ <div id="progressDone"></div>
+ </div>
</body>
</html>
View
104 demos/Zend/ProgressBar/ZendForm.php
@@ -1,39 +1,30 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_ProgressBar
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_ProgressBar
*/
+use Zend\File\Transfer\Adapter\Http;
+use Zend\Form\Form;
+use Zend\Loader\StandardAutoloader;
+use Zend\ProgressBar\Adapter\JsPull;
+
/**
* This sample file demonstrates an advanced use case of Zend_ProgressBar with
* Zend_Form and Zend_File_Transfer.
*/
-set_include_path(realpath(__DIR__ . '/../../../library')
- . PATH_SEPARATOR . get_include_path());
+require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
+$loader->register();
if (isset($_GET['progress_key'])) {
- require_once 'Zend/File/Transfer/Adapter/Http.php';
- require_once 'Zend/ProgressBar.php';
- require_once 'Zend/ProgressBar/Adapter/JsPull.php';
-
- $adapter = new Zend_ProgressBar_Adapter_JsPull();
- Zend_File_Transfer_Adapter_Http::getProgress(array('progress' => $adapter));
+ $adapter = new JsPull();
+ Http::getProgress(array('progress' => $adapter));
die;
}
?>
@@ -109,8 +100,7 @@
}
</style>
<script type="text/javascript">
- function makeRequest(url)
- {
+ function makeRequest(url) {
var httpRequest;
if (window.XMLHttpRequest) {
@@ -124,7 +114,8 @@ function makeRequest(url)
} catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {}
+ } catch (e) {
+ }
}
}
@@ -133,24 +124,23 @@ function makeRequest(url)
return false;
}
- httpRequest.onreadystatechange = function() { evalProgress(httpRequest); };
+ httpRequest.onreadystatechange = function () {
+ evalProgress(httpRequest);
+ };
httpRequest.open('GET', url, true);
httpRequest.send('');
}
- function observeProgress()
- {
+ function observeProgress() {
setTimeout("getProgress()", 1500);
}
- function getProgress()
- {
+ function getProgress() {
makeRequest('ZendForm.php?progress_key=' + document.getElementById('progress_key').value);
}
- function evalProgress(httpRequest)
- {
+ function evalProgress(httpRequest) {
try {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
@@ -166,21 +156,19 @@ function evalProgress(httpRequest)
alert('There was a problem with the request.');
}
}
- } catch(e) {
+ } catch (e) {
alert('Caught Exception: ' + e.description);
}
}
- function update(data)
- {
+ function update(data) {
document.getElementById('pg-percent').style.width = data.percent + '%';
document.getElementById('pg-text-1').innerHTML = data.text;
document.getElementById('pg-text-2').innerHTML = data.text;
}
- function finish()
- {
+ function finish() {
document.getElementById('pg-percent').style.width = '100%';
document.getElementById('pg-text-1').innerHTML = 'Upload done';
@@ -189,11 +177,9 @@ function finish()
</script>
</head>
<body>
- <?php
- require_once 'Zend/View.php';
- require_once 'Zend/Form.php';
-
- $form = new Zend_Form(array(
+<?php
+$form = new Form(
+ array(
'enctype' => 'multipart/form-data',
'action' => 'ZendForm.php',
'target' => 'uploadTarget',
@@ -202,24 +188,26 @@ function finish()
'file' => array('file', array('label' => 'File')),
'submit' => array('submit', array('label' => 'Upload!'))
)
- ));
+ )
+);
+$form->prepare();
- $form->setView(new Zend_View());
-
- echo $form;
- ?>
- <iframe name="uploadTarget"></iframe>
+echo $form;
+?>
+<iframe name="uploadTarget"></iframe>
- <div id="progressbar">
- <div class="pg-progressbar">
- <div class="pg-progress" id="pg-percent">
- <div class="pg-progressstyle"></div>
- <div class="pg-invertedtext" id="pg-text-1"></div>
- </div>
- <div class="pg-text" id="pg-text-2"></div>
+<div id="progressbar">
+ <div class="pg-progressbar">
+ <div class="pg-progress" id="pg-percent">
+ <div class="pg-progressstyle"></div>
+ <div class="pg-invertedtext" id="pg-text-1"></div>
</div>
+ <div class="pg-text" id="pg-text-2"></div>
</div>
- <div id="progressBar"><div id="progressDone"></div></div>
+</div>
+<div id="progressBar">
+ <div id="progressDone"></div>
+</div>
</body>
</html>
View
38 demos/Zend/WebServices/Amazon/amazon-search.php → demos/Zend/Service/Amazon/amazon-search.php
@@ -1,32 +1,26 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Service_Amazon
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_Service
*/
+use Zend\Loader\StandardAutoloader;
+use Zend\Service\Amazon\Exception\ExceptionInterface as AmazonException;
+use Zend\Service\Amazon\Query;
+
/**
* Query Amazon's Product Database
*/
-/**
- * @see Zend_Service_Amazon_Query
- */
-require_once 'Zend/Service/Amazon/Query.php';
+error_reporting(E_ALL);
+
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
+$loader->register();
$keywords = '';
$searchFor = '';
@@ -166,7 +160,7 @@
</form>
<?php
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
- $amazon = new Zend_Service_Amazon_Query("1338XJTNFMTHK413WFR2");
+ $amazon = new Query("1338XJTNFMTHK413WFR2");
try {
$amazon->category($searchFor)->ResponseGroup('Large')->Keywords($keywords);
@@ -204,7 +198,7 @@
echo '</div>';
}
}
- catch (Zend_Service_Exception $e) {
+ catch (AmazonException $e) {
echo '<p style="color: red; font-weight: bold">An error occured, please try again later. (' .$e->getMessage(). ')</p>';
}
}
View
38 demos/Zend/WebServices/Flickr/flickr-composite.php → demos/Zend/Service/Flickr/flickr-composite.php
@@ -1,32 +1,24 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Service_Flickr
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_Service
*/
+use Zend\Loader\StandardAutoloader;
+use Zend\Service\Flickr\Exception\ExceptionInterface as FlickrException;
+use Zend\Service\Flickr\Flickr;
+
/**
* Query Yahoo! Web, Image and News searches
*/
-/**
- * @see Zend_Service_Flickr
- */
-require_once 'Zend/Service/Flickr.php';
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
+$loader->register();
if (isset($_POST) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$keywords = strip_tags($_POST['search_term']);
@@ -95,7 +87,7 @@
</form>
<?php
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
- $flickr = new Zend_Service_Flickr('381e601d332ab5ce9c25939570cb5c4b');
+ $flickr = new Flickr('381e601d332ab5ce9c25939570cb5c4b');
try {
$results = $flickr->tagSearch($keywords, array('per_page' => 50, 'tag_mode' => 'all'));
@@ -152,8 +144,8 @@
echo '<p style="color: orange; font-weight: bold">No Results Found</p>';
}
}
- catch (Zend_Service_Exception $e) {
- echo '<p style="color: red; font-weight: bold">An error occured, please try again later. (' .$e->getMessage(). ')</p>';
+ catch (FlickrException $e) {
+ echo '<p style="color: red; font-weight: bold">An error occurred, please try again later. (' .$e->getMessage(). ')</p>';
}
}
?>
View
33 demos/Zend/Service/Flickr/flickr-search.php
@@ -0,0 +1,33 @@
+<?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_Service
+ */
+
+use Zend\Loader\StandardAutoloader;
+use Zend\Service\Flickr\Exception\ExceptionInterface as FlickrException;
+use Zend\Service\Flickr\Flickr;
+
+/**
+ * Query Flickr for a tag and display all of the photos for
+ * that tag.
+ */
+
+error_reporting(E_ALL);
+
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
+$loader->register();
+
+$flickr = new Flickr('your api key here');
+
+$photos = $flickr->tagSearch('php');
+
+foreach ($photos as $photo) {
+ echo '<img src="' . $photo->Thumbnail->uri . '" /> <br />';
+ echo $photo->title . "<br /> \n";
+}
View
1  demos/Zend/Service/LiveDocx/.gitignore
@@ -0,0 +1 @@
+DemoConfiguration.php
View
8 demos/Zend/Service/LiveDocx/Bootstrap.php
@@ -1,9 +1,8 @@
<?php
// Set used namespaces
-use \Zend\Loader\StandardAutoloader;
-use \Zend\Locale\Locale;
-use \Zend\Service\LiveDocx\Helper;
+use Zend\Loader\StandardAutoloader;
+use Zend\Service\LiveDocx\Helper;
// Turn up error reporting
error_reporting(E_ALL | E_STRICT);
@@ -20,9 +19,6 @@
// Include utility class
require_once "{$base}/demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php";
-// Set fallback locale
-Locale::setFallback(Helper::LOCALE);
-
// Ensure LiveDocx credentials are available
if (false === Helper::credentialsAvailable()) {
Helper::printLine(Helper::credentialsHowTo());
View
24 demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist
@@ -1,23 +1,11 @@
<?php
-
/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Service
- * @subpackage LiveDocx
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * 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_Service
*/
/**
View
9 demos/Zend/Service/LiveDocx/MailMerge/bitmaps/generate-bitmaps.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\MailMerge;
$mailMerge = new MailMerge();
@@ -13,11 +12,13 @@
$mailMerge->setLocalTemplate('template.docx');
+$date = new DateTime();
+
$mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
->assign('licensee', 'Daï Lemaitre')
->assign('company', 'Megasoft Co-operation')
- ->assign('date', Date::now()->toString(Date::DATE_LONG))
- ->assign('time', Date::now()->toString(Date::TIME_LONG))
+ ->assign('date', $date->format('Y-m-d'))
+ ->assign('time', $date->format('H:i:s'))
->assign('city', 'Lyon')
->assign('country', 'France');
View
7 demos/Zend/Service/LiveDocx/MailMerge/conference-pass/generate-document.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\MailMerge;
$mailMerge = new MailMerge();
@@ -23,9 +22,11 @@
$mailMerge->setLocalTemplate('template.docx');
+$date = new DateTime();
+
$mailMerge->assign('name', 'Daï Lemaitre')
->assign('company', 'Megasoft Co-operation')
- ->assign('date', Date::now()->toString(Date::DATE_LONG))
+ ->assign('date', $date->format('Y-m-d'))
->assign('image:photo', $photoFilename);
$mailMerge->createDocument();
View
20 demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php
@@ -32,10 +32,9 @@
* location. The specified paths are correct for Debian 5.0.3.
*/
-use Zend\Date\Date;
+use DateTime;
use Zend\Log\Logger;
use Zend\Log\Writer\Stream as Writer;
-use Zend\Registry;
use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;
@@ -75,8 +74,6 @@
$logger = new Logger(new Writer('php://stdout'));
-Registry::set('logger', $logger);
-
// -----------------------------------------------------------------------------
// Create temporary directory
@@ -104,6 +101,8 @@
$mailMerge->setLocalTemplate('template.docx');
+$date = new DateTime();
+
for ($iteration = 1; $iteration <= $iterations; $iteration ++) {
$tempFilename = sprintf('%s%s%010s.pdf', $tempDirectory, DIRECTORY_SEPARATOR, $iteration);
@@ -112,8 +111,8 @@
$mailMerge->assign('software', randomString())
->assign('licensee', randomString())
->assign('company', randomString())
- ->assign('date', Date::now()->toString(Date::DATE_LONG))
- ->assign('time', Date::now()->toString(Date::TIME_LONG))
+ ->assign('date', $date->format('Y-m-d'))
+ ->assign('time', $date->format('H:i:s'))
->assign('city', randomString())
->assign('country', randomString());
@@ -156,8 +155,7 @@
/**
* Create a random string
- *
- * @param $length
+ *
* @return string
*/
function randomString()
@@ -213,9 +211,9 @@ function recursiveRemoveDirectory($dir)
function concatenatePdfFilenames($inputFilenames, $outputFilename, $processor = EXEC_PDFTK)
{
$ret = false;
-
- $logger = Registry::get('logger');
-
+
+ $logger = new Logger(new Writer('php://stdout'));
+
if (! (is_file(EXEC_PDFTK) || is_file(EXEC_GHOSTSCRIPT))) {
$logger->log('Either pdftk or ghostscript are required for this sample application.', Logger::CRIT);
exit();
View
9 demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\MailMerge;
$mailMerge = new MailMerge();
@@ -13,11 +12,13 @@
$mailMerge->setLocalTemplate('template.docx');
+$date = new DateTime();
+
$mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
->assign('licensee', 'Henry Döner-Meyer')
->assign('company', 'Co-Operation')
- ->assign('date', Date::now()->toString(Date::DATE_LONG))
- ->assign('time', Date::now()->toString(Date::TIME_LONG))
+ ->assign('date', $date->format('Y-m-d'))
+ ->assign('time', $date->format('H:i:s'))
->assign('city', 'Berlin')
->assign('country', 'Germany');
View
11 demos/Zend/Service/LiveDocx/MailMerge/metafiles/generate-metafiles.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\MailMerge;
$mailMerge = new MailMerge();
@@ -12,12 +11,14 @@
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);
$mailMerge->setLocalTemplate('template.docx');
-
+
+$date = new DateTime();
+
$mailMerge->setFieldValue('software', 'Magic Graphical Compression Suite v1.9')
->setFieldValue('licensee', 'Henry Döner-Meyer')
->setFieldValue('company', 'Megasoft Co-operation')
- ->setFieldValue('date', Date::now()->toString(Date::DATE_LONG))
- ->setFieldValue('time', Date::now()->toString(Date::TIME_LONG))
+ ->setFieldValue('date', $date->format('Y-m-d'))
+ ->setFieldValue('time', $date->format('H:i:s'))
->setFieldValue('city', 'Bremen')
->setFieldValue('country', 'Germany');
View
9 demos/Zend/Service/LiveDocx/MailMerge/pdf-security/generate-document.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\MailMerge;
$mailMerge = new MailMerge();
@@ -17,11 +16,13 @@
$mailMerge->setLocalTemplate('template.docx');
+$date = new DateTime();
+
$mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
->assign('licensee', 'Henry Döner-Meyer')
->assign('company', 'Co-Operation')
- ->assign('date', Date::now()->toString(Date::DATE_LONG))
- ->assign('time', Date::now()->toString(Date::TIME_LONG))
+ ->assign('date', $date->format('Y-m-d'))
+ ->assign('time', $date->format('H:i:s'))
->assign('city', 'Berlin')
->assign('country', 'Germany');
View
25 demos/Zend/Service/LiveDocx/MailMerge/supported-fonts/show-supported-fonts-cached.php
@@ -2,29 +2,26 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Cache\Cache;
+use Zend\Cache\StorageFactory;
use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;
$cacheId = md5(__FILE__);
-$cacheFrontendOptions = array(
- 'lifetime' => 2592000, // 30 days
- 'automatic_serialization' => true
-);
-
-$cacheBackendOptions = array(
- 'cache_dir' => __DIR__ . '/cache'
+$cache = array(
+ 'adapter' => 'FileSystem',
+ 'options' => array(
+ 'cache_dir' => __DIR__ . '/cache',
+ ),
);
-if (!is_dir($cacheBackendOptions['cache_dir'])) {
- mkdir($cacheBackendOptions['cache_dir']);
+if (!is_dir($cache['options']['cache_dir'])) {
+ mkdir($cache['options']['cache_dir']);
}
-$cache = Cache::factory('Core', 'File', $cacheFrontendOptions, $cacheBackendOptions);
+$cache = StorageFactory::factory($cache);
-if (! $fonts = $cache->load($cacheId)) {
+if (! $fonts = $cache->getItem($cacheId)) {
// Cache miss. Connect to backend service (expensive).
@@ -35,7 +32,7 @@
$fonts = $mailMerge->getFontNames();
- $cache->save($fonts, $cacheId);
+ $cache->addItem($fonts, $cacheId);
unset($mailMerge);
View
25 demos/Zend/Service/LiveDocx/MailMerge/supported-formats/show-supported-formats-cached.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Cache\Cache;
+use Zend\Cache\StorageFactory;
use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;
@@ -19,22 +18,20 @@
$cacheId = md5(__FILE__);
-$cacheFrontendOptions = array(
- 'lifetime' => 2592000, // 30 days
- 'automatic_serialization' => true
-);
-
-$cacheBackendOptions = array(
- 'cache_dir' => __DIR__ . '/cache'
+$cache = array(
+ 'adapter' => 'FileSystem',
+ 'options' => array(
+ 'cache_dir' => __DIR__ . '/cache',
+ ),
);
-if (!is_dir($cacheBackendOptions['cache_dir'])) {
- mkdir($cacheBackendOptions['cache_dir']);
+if (!is_dir($cache['options']['cache_dir'])) {
+ mkdir($cache['options']['cache_dir']);
}
-$cache = Cache::factory('Core', 'File', $cacheFrontendOptions, $cacheBackendOptions);
+$cache = StorageFactory::factory($cache);
-if (! $formats = $cache->load($cacheId)) {
+if (! $formats = $cache->getItem($cacheId)) {
// Cache miss. Connect to backend service (expensive).
@@ -49,7 +46,7 @@
$formats->document = $mailMerge->getDocumentFormats();
$formats->image = $mailMerge->getImageExportFormats();
- $cache->save($formats, $cacheId);
+ $cache->setItem($formats, $cacheId);
unset($mailMerge);
View
10 demos/Zend/Service/LiveDocx/MailMerge/telephone-bill/generate-document.php
@@ -2,8 +2,7 @@
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
-
-use Zend\Date\Date;
+use DateTime;
use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;
@@ -31,14 +30,15 @@
->assign('invoice_number', sprintf("#%'10s", rand(0,1000000000)))
->assign('account_number', sprintf("#%'10s", rand(0,1000000000)));
+$date = new DateTime();
+
$billData = array (
'phone' => '+22 (0)333 444 555',
- 'date' => Date::now()->toString(Date::DATE_LONG),
+ 'date' => $date->format('Y-m-d'),
'name' => 'James Henry Brown',
'service_phone' => '+22 (0)333 444 559',
'service_fax' => '+22 (0)333 444 558',
- 'month' => sprintf('%s %s', Date::now()->toString(Date::MONTH_NAME),
- Date::now()->toString(Date::YEAR)),
+ 'month' => $date->format('F Y'),
'monthly_fee' => '15.00',
'total_net' => '19.60',
'tax' => '19.00',
View
46 demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php
@@ -1,33 +1,21 @@
<?php
/**
- * Zend Framework
+ * Zend Framework (http://framework.zend.com/)
*
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Service
- * @subpackage LiveDocx
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @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_Service
*/
namespace Zend\Service\LiveDocx;
-use Zend\Date\Date;
+
+use DateTime;
/**
- * @category Demos
- * @package Demos_Zend_Service
- * @subpackage LiveDocx
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @category Zend
+ * @package Zend_Service
+ * @subpackage Demos
*/
class Helper
{
@@ -142,14 +130,12 @@ public static function listDecorator($result)
{
$ret = '';
- $date = new Date();
-
if (count($result) > 0) {
foreach ($result as $record) {
- $date->set($record['createTime']);
- $createTimeFormatted = $date->get(Date::RFC_1123);
- $date->set($record['modifyTime']);
- $modifyTimeFormatted = $date->get(Date::RFC_1123);
+ $date = new DateTime($record['createTime']);
+ $createTimeFormatted = $date->format(DateTime::RFC1123);
+ $date = new DateTime($record['modifyTime']);
+ $modifyTimeFormatted = $date->format(DateTime::RFC1123);
$ret .= sprintf(' Filename : %s%s', $record['filename'], PHP_EOL);
$ret .= sprintf(' File Size : %d b%s', $record['fileSize'], PHP_EOL);
$ret .= sprintf(' Creation Time : %d (%s)%s', $record['createTime'], $createTimeFormatted, PHP_EOL);
@@ -157,9 +143,7 @@ public static function listDecorator($result)
$ret .= PHP_EOL;
}
}
-
- unset($date);
-
+
return $ret;
}
View
41 demos/Zend/WebServices/Flickr/flickr-search.php
@@ -1,41 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Service_Flickr
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Query Flickr for a tag and display all of the photos for
- * that tag.
- */
-
-error_reporting(E_ALL);
-
-/**
- * @see Zend_Service_Flickr
- */
-require_once 'Zend/Service/Flickr.php';
-
-$flickr = new Zend_Service_Flickr('your api key here');
-
-$photos = $flickr->tagSearch('php');
-
-foreach ($photos as $photo) {
- echo '<img src="' . $photo->Thumbnail->uri . '" /> <br />';
- echo $photo->title . "<br /> \n";
-}
View
31 demos/Zend/WebServices/Protocols/xmlrpc-upc-lookup.php
@@ -1,31 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Demos
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_XmlRpc_Client
- */
-require_once 'Zend/XmlRpc/Client.php';
-
-$server = new Zend_XmlRpc_Client('http://www.upcdatabase.com/rpc');
-
-$client = $server->getProxy();
-
-print_r( $client->lookupUPC('071641301627') );
View
28 demos/Zend/XmlRpc/xmlrpc-upc-lookup.php
@@ -0,0 +1,28 @@
+<?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_XmlRpc
+ */
+
+use Zend\Loader\StandardAutoloader;
+use Zend\XmlRpc\Client;
+
+require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
+$loader->register();
+
+$server = new Client('http://www.upcdatabase.com/xmlrpc');
+
+$client = $server->getProxy();
+
+print_r($client->lookup(
+ array(
+ 'rpc_key' => '0000...0000', // Set your rpc_key here
+ 'upc' => '123456789012',
+ )
+ )
+);
View
2  library/Zend/ProgressBar/ProgressBar.php
@@ -14,7 +14,7 @@
use Zend\Session;
/**
- * Zend_ProgressBar offers an interface for multiple enviroments.
+ * Zend_ProgressBar offers an interface for multiple environments.
*
* @category Zend
* @package Zend_ProgressBar
View
2  library/Zend/Registry.php
@@ -24,7 +24,7 @@ class Registry extends ArrayObject
{
/**
* Constructs a parent ArrayObject with default
- * ARRAY_AS_PROPS to allow acces as an object
+ * ARRAY_AS_PROPS to allow access as an object
*
* @param array $array data array
* @param integer $flags ArrayObject flags
View
2  library/Zend/Service/LiveDocx/MailMerge.php
@@ -1043,7 +1043,7 @@ public function uploadImage($filename)
*
* @param string $filename
* @throws Exception\RuntimeException
- * @return void
+ * @return string
* @since LiveDocx 2.0
*/
public function downloadImage($filename)
Something went wrong with that request. Please try again.