Skip to content
This repository

[Demos] Update code to ZF2 Beta5 API #1834

Merged
merged 1 commit into from almost 2 years ago

3 participants

Maks Don't Add Me To Your Organization a.k.a The Travis Bot Matthew Weier O'Phinney
Maks
Collaborator
Maks3w commented July 10, 2012

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

Don't Add Me To Your Organization a.k.a The Travis Bot

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

Matthew Weier O'Phinney weierophinney merged commit 1a90d91 into from July 10, 2012
Matthew Weier O'Phinney weierophinney closed this July 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 10, 2012
Maks [Demos] Update code to ZF2 Beta5 API 1a90d91
This page is out of date. Refresh to see the latest.

Showing 26 changed files with 291 additions and 394 deletions. Show diff stats Hide diff stats

  1. 28  demos/Zend/Feeds/consume-feed.php
  2. 56  demos/Zend/ProgressBar/JsPush.php
  3. 78  demos/Zend/ProgressBar/Upload.php
  4. 104  demos/Zend/ProgressBar/ZendForm.php
  5. 38  demos/Zend/{WebServices → Service}/Amazon/amazon-search.php
  6. 38  demos/Zend/{WebServices → Service}/Flickr/flickr-composite.php
  7. 33  demos/Zend/Service/Flickr/flickr-search.php
  8. 1  demos/Zend/Service/LiveDocx/.gitignore
  9. 8  demos/Zend/Service/LiveDocx/Bootstrap.php
  10. 24  demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist
  11. 9  demos/Zend/Service/LiveDocx/MailMerge/bitmaps/generate-bitmaps.php
  12. 7  demos/Zend/Service/LiveDocx/MailMerge/conference-pass/generate-document.php
  13. 20  demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php
  14. 9  demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document.php
  15. 11  demos/Zend/Service/LiveDocx/MailMerge/metafiles/generate-metafiles.php
  16. 9  demos/Zend/Service/LiveDocx/MailMerge/pdf-security/generate-document.php
  17. 25  demos/Zend/Service/LiveDocx/MailMerge/supported-fonts/show-supported-fonts-cached.php
  18. 25  demos/Zend/Service/LiveDocx/MailMerge/supported-formats/show-supported-formats-cached.php
  19. 10  demos/Zend/Service/LiveDocx/MailMerge/telephone-bill/generate-document.php
  20. 46  demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php
  21. 41  demos/Zend/WebServices/Flickr/flickr-search.php
  22. 31  demos/Zend/WebServices/Protocols/xmlrpc-upc-lookup.php
  23. 28  demos/Zend/XmlRpc/xmlrpc-upc-lookup.php
  24. 2  library/Zend/ProgressBar/ProgressBar.php
  25. 2  library/Zend/Registry.php
  26. 2  library/Zend/Service/LiveDocx/MailMerge.php
28  demos/Zend/Feeds/consume-feed.php
... ...
@@ -1,22 +1,11 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_Feed
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_Feed
20 9
  */
21 10
 
22 11
 use Zend\Loader\StandardAutoloader;
@@ -28,14 +17,13 @@
28 17
  */
29 18
 
30 19
 require_once dirname(dirname(dirname(__DIR__))).'/library/Zend/Loader/StandardAutoloader.php';
31  
-$loader = new StandardAutoloader;
  20
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
32 21
 $loader->register();
33 22
 
34 23
 
35 24
 $rss = Reader::import('http://news.google.com/?output=rss');
36 25
 
37 26
 foreach ($rss as $item) {
38  
-
39  
-    echo "<p>" . $item->getTitle() . "<br />", "\n";
40  
-    echo $item->getLink()  . "</p>";
  27
+    echo '<p>' . $item->getTitle() . '<br />', "\n";
  28
+    echo $item->getLink()  . '</p>';
41 29
 }
56  demos/Zend/ProgressBar/JsPush.php
... ...
@@ -1,45 +1,36 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_ProgressBar
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_ProgressBar
20 9
  */
21 10
 
  11
+use Zend\Loader\StandardAutoloader;
  12
+use Zend\ProgressBar\Adapter\JsPush;
  13
+use Zend\ProgressBar\ProgressBar;
  14
+
22 15
 /**
23 16
  * This sample file demonstrates a simple use case of a jspush-driven progressbar
24 17
  */
25 18
 
26 19
 if (isset($_GET['progress'])) {
27  
-    set_include_path(realpath(__DIR__ . '/../../../library')
28  
-                     . PATH_SEPARATOR . get_include_path());
  20
+    require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
  21
+    $loader = new StandardAutoloader(array('autoregister_zf' => true));
  22
+    $loader->register();
29 23
 
30  
-    require_once 'Zend/ProgressBar.php';
31  
-    require_once 'Zend/ProgressBar/Adapter/JsPush.php';
32  
-
33  
-    $adapter     = new Zend_ProgressBar_Adapter_JsPush(array('updateMethodName' => 'Zend_ProgressBar_Update',
34  
-                                                             'finishMethodName' => 'Zend_ProgressBar_Finish'));
35  
-    $progressBar = new Zend_ProgressBar($adapter, 0, 100);
  24
+    $adapter     = new JsPush(array('updateMethodName' => 'Zend_ProgressBar_Update',
  25
+                                    'finishMethodName' => 'Zend_ProgressBar_Finish'));
  26
+    $progressBar = new ProgressBar($adapter, 0, 100);
36 27
 
37 28
     for ($i = 1; $i <= 100; $i++) {
38 29
         if ($i < 20) {
39 30
             $text = 'Just beginning';
40  
-        } else if ($i < 50) {
  31
+        } elseif ($i < 50) {
41 32
             $text = 'A bit done';
42  
-        } else if ($i < 80) {
  33
+        } elseif ($i < 80) {
43 34
             $text = 'Getting closer';
44 35
         } else {
45 36
             $text = 'Nearly done';
@@ -126,23 +117,20 @@
126 117
         }
127 118
     </style>
128 119
     <script type="text/javascript">
129  
-        function startProgress()
130  
-        {
  120
+        function startProgress() {
131 121
             var iFrame = document.createElement('iframe');
132 122
             document.getElementsByTagName('body')[0].appendChild(iFrame);
133 123
             iFrame.src = 'JsPush.php?progress';
134 124
         }
135 125
 
136  
-        function Zend_ProgressBar_Update(data)
137  
-        {
  126
+        function Zend_ProgressBar_Update(data) {
138 127
             document.getElementById('pg-percent').style.width = data.percent + '%';
139 128
 
140 129
             document.getElementById('pg-text-1').innerHTML = data.text;
141 130
             document.getElementById('pg-text-2').innerHTML = data.text;
142 131
         }
143 132
 
144  
-        function Zend_ProgressBar_Finish()
145  
-        {
  133
+        function Zend_ProgressBar_Finish() {
146 134
             document.getElementById('pg-percent').style.width = '100%';
147 135
 
148 136
             document.getElementById('pg-text-1').innerHTML = 'Demo done';
@@ -160,6 +148,8 @@ function Zend_ProgressBar_Finish()
160 148
             <div class="pg-text" id="pg-text-2"></div>
161 149
         </div>
162 150
     </div>
163  
-    <div id="progressBar"><div id="progressDone"></div></div>
  151
+    <div id="progressBar">
  152
+        <div id="progressDone"></div>
  153
+    </div>
164 154
 </body>
165 155
 </html>
78  demos/Zend/ProgressBar/Upload.php
... ...
@@ -1,42 +1,32 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_ProgressBar
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_ProgressBar
20 9
  */
21 10
 
  11
+use Zend\Loader\StandardAutoloader;
  12
+use Zend\ProgressBar\Adapter\JsPull;
  13
+use Zend\ProgressBar\ProgressBar;
  14
+
22 15
 /**
23 16
  * This sample file demonstrates a simple use case of a jspull-driven progressbar
24 17
  */
25 18
 
26 19
 if (isset($_GET['uploadId'])) {
27  
-    set_include_path(realpath(__DIR__ . '/../../../library')
28  
-                     . PATH_SEPARATOR . get_include_path());
29  
-
30  
-    require_once 'Zend/ProgressBar.php';
31  
-    require_once 'Zend/ProgressBar/Adapter/JsPull.php';
32  
-    require_once 'Zend/Session/Namespace.php';
  20
+    require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
  21
+    $loader = new StandardAutoloader(array('autoregister_zf' => true));
  22
+    $loader->register();
33 23
 
34 24
     $data          = uploadprogress_get_info($_GET['uploadId']);
35 25
     $bytesTotal    = ($data === null ? 0 : $data['bytes_total']);
36 26
     $bytesUploaded = ($data === null ? 0 : $data['bytes_uploaded']);
37 27
 
38  
-    $adapter     = new Zend_ProgressBar_Adapter_JsPull();
39  
-    $progressBar = new Zend_ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
  28
+    $adapter     = new JsPull();
  29
+    $progressBar = new ProgressBar($adapter, 0, $bytesTotal, 'uploadProgress');
40 30
 
41 31
     if ($bytesTotal === $bytesUploaded) {
42 32
         $progressBar->finish();
@@ -117,8 +107,7 @@
117 107
         }
118 108
     </style>
119 109
     <script type="text/javascript">
120  
-        function makeRequest(url)
121  
-        {
  110
+        function makeRequest(url) {
122 111
             var httpRequest;
123 112
 
124 113
             if (window.XMLHttpRequest) {
@@ -132,7 +121,8 @@ function makeRequest(url)
132 121
                 } catch (e) {
133 122
                     try {
134 123
                         httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
135  
-                    } catch (e) {}
  124
+                    } catch (e) {
  125
+                    }
136 126
                 }
137 127
             }
138 128
 
@@ -141,24 +131,23 @@ function makeRequest(url)
141 131
                 return false;
142 132
             }
143 133
 
144  
-            httpRequest.onreadystatechange = function() { evalProgress(httpRequest); };
  134
+            httpRequest.onreadystatechange = function () {
  135
+                evalProgress(httpRequest);
  136
+            };
145 137
             httpRequest.open('GET', url, true);
146 138
             httpRequest.send('');
147 139
 
148 140
         }
149 141
 
150  
-        function observeProgress()
151  
-        {
  142
+        function observeProgress() {
152 143
             setTimeout("getProgress()", 1500);
153 144
         }
154 145
 
155  
-        function getProgress()
156  
-        {
  146
+        function getProgress() {
157 147
             makeRequest('Upload.php?uploadId=' + document.getElementById('uploadId').value);
158 148
         }
159 149
 
160  
-        function evalProgress(httpRequest)
161  
-        {
  150
+        function evalProgress(httpRequest) {
162 151
             try {
163 152
                 if (httpRequest.readyState == 4) {
164 153
                     if (httpRequest.status == 200) {
@@ -174,21 +163,19 @@ function evalProgress(httpRequest)
174 163
                         alert('There was a problem with the request.');
175 164
                     }
176 165
                 }
177  
-            } catch(e) {
  166
+            } catch (e) {
178 167
                 alert('Caught Exception: ' + e.description);
179 168
             }
180 169
         }
181 170
 
182  
-        function update(data)
183  
-        {
  171
+        function update(data) {
184 172
             document.getElementById('pg-percent').style.width = data.percent + '%';
185 173
 
186 174
             document.getElementById('pg-text-1').innerHTML = data.timeRemaining + ' seconds remaining';
187 175
             document.getElementById('pg-text-2').innerHTML = data.timeRemaining + ' seconds remaining';
188 176
         }
189 177
 
190  
-        function finish()
191  
-        {
  178
+        function finish() {
192 179
             document.getElementById('pg-percent').style.width = '100%';
193 180
 
194 181
             document.getElementById('pg-text-1').innerHTML = 'Upload done';
@@ -197,10 +184,11 @@ function finish()
197 184
     </script>
198 185
 </head>
199 186
 <body>
200  
-    <form enctype="multipart/form-data" method="post" action="Upload.php" target="uploadTarget" onsubmit="observeProgress();">
201  
-        <input type="hidden" name="UPLOAD_IDENTIFIER" id="uploadId" value="<?php echo md5(uniqid(rand())); ?>" />
202  
-        <input type="file" name="file" />
203  
-        <input type="submit" value="Upload!" />
  187
+    <form enctype="multipart/form-data" method="post" action="Upload.php" target="uploadTarget"
  188
+          onsubmit="observeProgress();">
  189
+        <input type="hidden" name="UPLOAD_IDENTIFIER" id="uploadId" value="<?php echo md5(uniqid(rand())); ?>"/>
  190
+        <input type="file" name="file"/>
  191
+        <input type="submit" value="Upload!"/>
204 192
     </form>
205 193
     <iframe name="uploadTarget"></iframe>
206 194
 
@@ -213,6 +201,8 @@ function finish()
213 201
             <div class="pg-text" id="pg-text-2"></div>
214 202
         </div>
215 203
     </div>
216  
-    <div id="progressBar"><div id="progressDone"></div></div>
  204
+    <div id="progressBar">
  205
+        <div id="progressDone"></div>
  206
+    </div>
217 207
 </body>
218 208
 </html>
104  demos/Zend/ProgressBar/ZendForm.php
... ...
@@ -1,39 +1,30 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_ProgressBar
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_ProgressBar
20 9
  */
21 10
 
  11
+use Zend\File\Transfer\Adapter\Http;
  12
+use Zend\Form\Form;
  13
+use Zend\Loader\StandardAutoloader;
  14
+use Zend\ProgressBar\Adapter\JsPull;
  15
+
22 16
 /**
23 17
  * This sample file demonstrates an advanced use case of Zend_ProgressBar with
24 18
  * Zend_Form and Zend_File_Transfer.
25 19
  */
26 20
 
27  
-set_include_path(realpath(__DIR__ . '/../../../library')
28  
-                 . PATH_SEPARATOR . get_include_path());
  21
+require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
  22
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
  23
+$loader->register();
29 24
 
30 25
 if (isset($_GET['progress_key'])) {
31  
-    require_once 'Zend/File/Transfer/Adapter/Http.php';
32  
-    require_once 'Zend/ProgressBar.php';
33  
-    require_once 'Zend/ProgressBar/Adapter/JsPull.php';
34  
-
35  
-    $adapter = new Zend_ProgressBar_Adapter_JsPull();
36  
-    Zend_File_Transfer_Adapter_Http::getProgress(array('progress' => $adapter));
  26
+    $adapter = new JsPull();
  27
+    Http::getProgress(array('progress' => $adapter));
37 28
     die;
38 29
 }
39 30
 ?>
@@ -109,8 +100,7 @@
109 100
         }
110 101
     </style>
111 102
     <script type="text/javascript">
112  
-        function makeRequest(url)
113  
-        {
  103
+        function makeRequest(url) {
114 104
             var httpRequest;
115 105
 
116 106
             if (window.XMLHttpRequest) {
@@ -124,7 +114,8 @@ function makeRequest(url)
124 114
                 } catch (e) {
125 115
                     try {
126 116
                         httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
127  
-                    } catch (e) {}
  117
+                    } catch (e) {
  118
+                    }
128 119
                 }
129 120
             }
130 121
 
@@ -133,24 +124,23 @@ function makeRequest(url)
133 124
                 return false;
134 125
             }
135 126
 
136  
-            httpRequest.onreadystatechange = function() { evalProgress(httpRequest); };
  127
+            httpRequest.onreadystatechange = function () {
  128
+                evalProgress(httpRequest);
  129
+            };
137 130
             httpRequest.open('GET', url, true);
138 131
             httpRequest.send('');
139 132
 
140 133
         }
141 134
 
142  
-        function observeProgress()
143  
-        {
  135
+        function observeProgress() {
144 136
             setTimeout("getProgress()", 1500);
145 137
         }
146 138
 
147  
-        function getProgress()
148  
-        {
  139
+        function getProgress() {
149 140
             makeRequest('ZendForm.php?progress_key=' + document.getElementById('progress_key').value);
150 141
         }
151 142
 
152  
-        function evalProgress(httpRequest)
153  
-        {
  143
+        function evalProgress(httpRequest) {
154 144
             try {
155 145
                 if (httpRequest.readyState == 4) {
156 146
                     if (httpRequest.status == 200) {
@@ -166,21 +156,19 @@ function evalProgress(httpRequest)
166 156
                         alert('There was a problem with the request.');
167 157
                     }
168 158
                 }
169  
-            } catch(e) {
  159
+            } catch (e) {
170 160
                 alert('Caught Exception: ' + e.description);
171 161
             }
172 162
         }
173 163
 
174  
-        function update(data)
175  
-        {
  164
+        function update(data) {
176 165
             document.getElementById('pg-percent').style.width = data.percent + '%';
177 166
 
178 167
             document.getElementById('pg-text-1').innerHTML = data.text;
179 168
             document.getElementById('pg-text-2').innerHTML = data.text;
180 169
         }
181 170
 
182  
-        function finish()
183  
-        {
  171
+        function finish() {
184 172
             document.getElementById('pg-percent').style.width = '100%';
185 173
 
186 174
             document.getElementById('pg-text-1').innerHTML = 'Upload done';
@@ -189,11 +177,9 @@ function finish()
189 177
     </script>
190 178
 </head>
191 179
 <body>
192  
-    <?php
193  
-    require_once 'Zend/View.php';
194  
-    require_once 'Zend/Form.php';
195  
-
196  
-    $form = new Zend_Form(array(
  180
+<?php
  181
+$form = new Form(
  182
+    array(
197 183
         'enctype'  => 'multipart/form-data',
198 184
         'action'   => 'ZendForm.php',
199 185
         'target'   => 'uploadTarget',
@@ -202,24 +188,26 @@ function finish()
202 188
             'file'   => array('file', array('label' => 'File')),
203 189
             'submit' => array('submit', array('label' => 'Upload!'))
204 190
         )
205  
-    ));
  191
+  )
  192
+);
  193
+$form->prepare();
206 194
 
207  
-    $form->setView(new Zend_View());
208  
-
209  
-    echo $form;
210  
-    ?>
211  
-    <iframe name="uploadTarget"></iframe>
  195
+echo $form;
  196
+?>
  197
+<iframe name="uploadTarget"></iframe>
212 198
 
213  
-    <div id="progressbar">
214  
-        <div class="pg-progressbar">
215  
-            <div class="pg-progress" id="pg-percent">
216  
-                <div class="pg-progressstyle"></div>
217  
-                <div class="pg-invertedtext" id="pg-text-1"></div>
218  
-            </div>
219  
-            <div class="pg-text" id="pg-text-2"></div>
  199
+<div id="progressbar">
  200
+    <div class="pg-progressbar">
  201
+        <div class="pg-progress" id="pg-percent">
  202
+            <div class="pg-progressstyle"></div>
  203
+            <div class="pg-invertedtext" id="pg-text-1"></div>
220 204
         </div>
  205
+        <div class="pg-text" id="pg-text-2"></div>
221 206
     </div>
222  
-    <div id="progressBar"><div id="progressDone"></div></div>
  207
+</div>
  208
+<div id="progressBar">
  209
+    <div id="progressDone"></div>
  210
+</div>
223 211
 </body>
224 212
 </html>
225 213
 
38  demos/Zend/WebServices/Amazon/amazon-search.php → demos/Zend/Service/Amazon/amazon-search.php
... ...
@@ -1,32 +1,26 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_Service_Amazon
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_Service
20 9
  */
21 10
 
  11
+use Zend\Loader\StandardAutoloader;
  12
+use Zend\Service\Amazon\Exception\ExceptionInterface as AmazonException;
  13
+use Zend\Service\Amazon\Query;
  14
+
22 15
 /**
23 16
  * Query Amazon's Product Database
24 17
  */
25 18
 
26  
-/**
27  
- * @see Zend_Service_Amazon_Query
28  
- */
29  
-require_once 'Zend/Service/Amazon/Query.php';
  19
+error_reporting(E_ALL);
  20
+
  21
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
  22
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
  23
+$loader->register();
30 24
 
31 25
 $keywords = '';
32 26
 $searchFor = '';
@@ -166,7 +160,7 @@
166 160
     </form>
167 161
 <?php
168 162
 if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
169  
-    $amazon = new Zend_Service_Amazon_Query("1338XJTNFMTHK413WFR2");
  163
+    $amazon = new Query("1338XJTNFMTHK413WFR2");
170 164
 
171 165
     try {
172 166
         $amazon->category($searchFor)->ResponseGroup('Large')->Keywords($keywords);
@@ -204,7 +198,7 @@
204 198
             echo '</div>';
205 199
         }
206 200
     }
207  
-    catch (Zend_Service_Exception $e) {
  201
+    catch (AmazonException $e) {
208 202
         echo '<p style="color: red; font-weight: bold">An error occured, please try again later. (' .$e->getMessage(). ')</p>';
209 203
     }
210 204
 }
38  demos/Zend/WebServices/Flickr/flickr-composite.php → demos/Zend/Service/Flickr/flickr-composite.php
... ...
@@ -1,32 +1,24 @@
1 1
 <?php
2 2
 /**
3  
- * Zend Framework
  3
+ * Zend Framework (http://framework.zend.com/)
4 4
  *
5  
- * LICENSE
6  
- *
7  
- * This source file is subject to the new BSD license that is bundled
8  
- * with this package in the file LICENSE.txt.
9  
- * It is also available through the world-wide-web at this URL:
10  
- * http://framework.zend.com/license/new-bsd
11  
- * If you did not receive a copy of the license and are unable to
12  
- * obtain it through the world-wide-web, please send an email
13  
- * to license@zend.com so we can send you a copy immediately.
14  
- *
15  
- * @category   Zend
16  
- * @package    Zend_Service_Flickr
17  
- * @subpackage Demos
18  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
19  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_Service
20 9
  */
21 10
 
  11
+use Zend\Loader\StandardAutoloader;
  12
+use Zend\Service\Flickr\Exception\ExceptionInterface as FlickrException;
  13
+use Zend\Service\Flickr\Flickr;
  14
+
22 15
 /**
23 16
  * Query Yahoo! Web, Image and News searches
24 17
  */
25 18
 
26  
-/**
27  
- * @see Zend_Service_Flickr
28  
- */
29  
-require_once 'Zend/Service/Flickr.php';
  19
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
  20
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
  21
+$loader->register();
30 22
 
31 23
 if (isset($_POST) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
32 24
     $keywords = strip_tags($_POST['search_term']);
@@ -95,7 +87,7 @@
95 87
     </form>
96 88
 <?php
97 89
 if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
98  
-    $flickr = new Zend_Service_Flickr('381e601d332ab5ce9c25939570cb5c4b');
  90
+    $flickr = new Flickr('381e601d332ab5ce9c25939570cb5c4b');
99 91
 
100 92
     try {
101 93
         $results = $flickr->tagSearch($keywords, array('per_page' => 50, 'tag_mode' => 'all'));
@@ -152,8 +144,8 @@
152 144
             echo '<p style="color: orange; font-weight: bold">No Results Found</p>';
153 145
         }
154 146
     }
155  
-    catch (Zend_Service_Exception $e) {
156  
-        echo '<p style="color: red; font-weight: bold">An error occured, please try again later. (' .$e->getMessage(). ')</p>';
  147
+    catch (FlickrException $e) {
  148
+        echo '<p style="color: red; font-weight: bold">An error occurred, please try again later. (' .$e->getMessage(). ')</p>';
157 149
     }
158 150
 }
159 151
 ?>
33  demos/Zend/Service/Flickr/flickr-search.php
... ...
@@ -0,0 +1,33 @@
  1
+<?php
  2
+/**
  3
+ * Zend Framework (http://framework.zend.com/)
  4
+ *
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_Service
  9
+ */
  10
+
  11
+use Zend\Loader\StandardAutoloader;
  12
+use Zend\Service\Flickr\Exception\ExceptionInterface as FlickrException;
  13
+use Zend\Service\Flickr\Flickr;
  14
+
  15
+/**
  16
+ * Query Flickr for a tag and display all of the photos for
  17
+ * that tag.
  18
+ */
  19
+
  20
+error_reporting(E_ALL);
  21
+
  22
+require_once dirname(dirname(dirname(dirname(__DIR__)))) . '/library/Zend/Loader/StandardAutoloader.php';
  23
+$loader = new StandardAutoloader(array('autoregister_zf' => true));
  24
+$loader->register();
  25
+
  26
+$flickr = new Flickr('your api key here');
  27
+
  28
+$photos = $flickr->tagSearch('php');
  29
+
  30
+foreach ($photos as $photo) {
  31
+    echo '<img src="' . $photo->Thumbnail->uri . '" /> <br />';
  32
+    echo $photo->title . "<br /> \n";
  33
+}
1  demos/Zend/Service/LiveDocx/.gitignore
... ...
@@ -0,0 +1 @@
  1
+DemoConfiguration.php
8  demos/Zend/Service/LiveDocx/Bootstrap.php
... ...
@@ -1,9 +1,8 @@
1 1
 <?php
2 2
 
3 3
 // Set used namespaces
4  
-use \Zend\Loader\StandardAutoloader;
5  
-use \Zend\Locale\Locale;
6  
-use \Zend\Service\LiveDocx\Helper;
  4
+use Zend\Loader\StandardAutoloader;
  5
+use Zend\Service\LiveDocx\Helper;
7 6
 
8 7
 // Turn up error reporting
9 8
 error_reporting(E_ALL | E_STRICT);
@@ -20,9 +19,6 @@
20 19
 // Include utility class
21 20
 require_once "{$base}/demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php";
22 21
 
23  
-// Set fallback locale
24  
-Locale::setFallback(Helper::LOCALE);
25  
-
26 22
 // Ensure LiveDocx credentials are available
27 23
 if (false === Helper::credentialsAvailable()) {
28 24
     Helper::printLine(Helper::credentialsHowTo());
24  demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist
... ...
@@ -1,23 +1,11 @@
1 1
 <?php
2  
-
3 2
 /**
4  
- * Zend Framework
5  
- *
6  
- * LICENSE
7  
- *
8  
- * This source file is subject to the new BSD license that is bundled
9  
- * with this package in the file LICENSE.txt.
10  
- * It is also available through the world-wide-web at this URL:
11  
- * http://framework.zend.com/license/new-bsd
12  
- * If you did not receive a copy of the license and are unable to
13  
- * obtain it through the world-wide-web, please send an email
14  
- * to license@zend.com so we can send you a copy immediately.
15  
- *
16  
- * @category   Zend
17  
- * @package    Zend_Service
18  
- * @subpackage LiveDocx
19  
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20  
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
  3
+ * Zend Framework (http://framework.zend.com/)
  4
+ *
  5
+ * @link      http://github.com/zendframework/zf2 for the canonical source repository
  6
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  7
+ * @license   http://framework.zend.com/license/new-bsd New BSD License
  8
+ * @package   Zend_Service
21 9
  */
22 10
 
23 11
 /**
9  demos/Zend/Service/LiveDocx/MailMerge/bitmaps/generate-bitmaps.php
@@ -2,8 +2,7 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Date\Date;
  5
+use DateTime;
7 6
 use Zend\Service\LiveDocx\MailMerge;
8 7
 
9 8
 $mailMerge = new MailMerge();
@@ -13,11 +12,13 @@
13 12
 
14 13
 $mailMerge->setLocalTemplate('template.docx');
15 14
 
  15
+$date = new DateTime();
  16
+
16 17
 $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
17 18
           ->assign('licensee', 'Daï Lemaitre')
18 19
           ->assign('company',  'Megasoft Co-operation')
19  
-          ->assign('date',     Date::now()->toString(Date::DATE_LONG))
20  
-          ->assign('time',     Date::now()->toString(Date::TIME_LONG))
  20
+          ->assign('date',     $date->format('Y-m-d'))
  21
+          ->assign('time',     $date->format('H:i:s'))
21 22
           ->assign('city',     'Lyon')
22 23
           ->assign('country',  'France');
23 24
 
7  demos/Zend/Service/LiveDocx/MailMerge/conference-pass/generate-document.php
@@ -2,8 +2,7 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Date\Date;
  5
+use DateTime;
7 6
 use Zend\Service\LiveDocx\MailMerge;
8 7
 
9 8
 $mailMerge = new MailMerge();
@@ -23,9 +22,11 @@
23 22
 
24 23
 $mailMerge->setLocalTemplate('template.docx');
25 24
 
  25
+$date = new DateTime();
  26
+
26 27
 $mailMerge->assign('name',        'Daï Lemaitre')
27 28
           ->assign('company',     'Megasoft Co-operation')
28  
-          ->assign('date',        Date::now()->toString(Date::DATE_LONG))
  29
+          ->assign('date',         $date->format('Y-m-d'))
29 30
           ->assign('image:photo', $photoFilename);
30 31
 
31 32
 $mailMerge->createDocument();
20  demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php
@@ -32,10 +32,9 @@
32 32
  *       location. The specified paths are correct for Debian 5.0.3.
33 33
  */
34 34
 
35  
-use Zend\Date\Date;
  35
+use DateTime;
36 36
 use Zend\Log\Logger;
37 37
 use Zend\Log\Writer\Stream as Writer;
38  
-use Zend\Registry;
39 38
 use Zend\Service\LiveDocx\Helper;
40 39
 use Zend\Service\LiveDocx\MailMerge;
41 40
 
@@ -75,8 +74,6 @@
75 74
 
76 75
 $logger = new Logger(new Writer('php://stdout'));
77 76
 
78  
-Registry::set('logger', $logger);
79  
-
80 77
 // -----------------------------------------------------------------------------
81 78
 
82 79
 // Create temporary directory
@@ -104,6 +101,8 @@
104 101
 
105 102
 $mailMerge->setLocalTemplate('template.docx');
106 103
 
  104
+$date = new DateTime();
  105
+
107 106
 for ($iteration = 1; $iteration <= $iterations; $iteration ++) {
108 107
     
109 108
     $tempFilename = sprintf('%s%s%010s.pdf', $tempDirectory, DIRECTORY_SEPARATOR, $iteration);
@@ -112,8 +111,8 @@
112 111
     $mailMerge->assign('software', randomString())
113 112
               ->assign('licensee', randomString())
114 113
               ->assign('company',  randomString())
115  
-              ->assign('date',     Date::now()->toString(Date::DATE_LONG))
116  
-              ->assign('time',     Date::now()->toString(Date::TIME_LONG))
  114
+              ->assign('date',     $date->format('Y-m-d'))
  115
+              ->assign('time',     $date->format('H:i:s'))
117 116
               ->assign('city',     randomString())
118 117
               ->assign('country',  randomString());
119 118
         
@@ -156,8 +155,7 @@
156 155
 
157 156
 /**
158 157
  * Create a random string
159  
- * 
160  
- * @param $length
  158
+ *
161 159
  * @return string
162 160
  */
163 161
 function randomString()
@@ -213,9 +211,9 @@ function recursiveRemoveDirectory($dir)
213 211
 function concatenatePdfFilenames($inputFilenames, $outputFilename, $processor = EXEC_PDFTK)
214 212
 {
215 213
     $ret = false;
216  
-    
217  
-    $logger = Registry::get('logger');
218  
-    
  214
+
  215
+    $logger = new Logger(new Writer('php://stdout'));
  216
+
219 217
     if (! (is_file(EXEC_PDFTK) || is_file(EXEC_GHOSTSCRIPT))) {
220 218
         $logger->log('Either pdftk or ghostscript are required for this sample application.', Logger::CRIT);
221 219
         exit();
9  demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document.php
@@ -2,8 +2,7 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Date\Date;
  5
+use DateTime;
7 6
 use Zend\Service\LiveDocx\MailMerge;
8 7
 
9 8
 $mailMerge = new MailMerge();
@@ -13,11 +12,13 @@
13 12
 
14 13
 $mailMerge->setLocalTemplate('template.docx');
15 14
 
  15
+$date = new DateTime();
  16
+
16 17
 $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
17 18
           ->assign('licensee', 'Henry Döner-Meyer')
18 19
           ->assign('company',  'Co-Operation')
19  
-          ->assign('date',     Date::now()->toString(Date::DATE_LONG))
20  
-          ->assign('time',     Date::now()->toString(Date::TIME_LONG))
  20
+          ->assign('date',     $date->format('Y-m-d'))
  21
+          ->assign('time',     $date->format('H:i:s'))
21 22
           ->assign('city',     'Berlin')
22 23
           ->assign('country',  'Germany');
23 24
 
11  demos/Zend/Service/LiveDocx/MailMerge/metafiles/generate-metafiles.php
@@ -2,8 +2,7 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Date\Date;
  5
+use DateTime;
7 6
 use Zend\Service\LiveDocx\MailMerge;
8 7
 
9 8
 $mailMerge = new MailMerge();
@@ -12,12 +11,14 @@
12 11
           ->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);
13 12
 
14 13
 $mailMerge->setLocalTemplate('template.docx');
15  
-            
  14
+
  15
+$date = new DateTime();
  16
+
16 17
 $mailMerge->setFieldValue('software', 'Magic Graphical Compression Suite v1.9')
17 18
           ->setFieldValue('licensee', 'Henry Döner-Meyer')
18 19
           ->setFieldValue('company',  'Megasoft Co-operation')
19  
-          ->setFieldValue('date',     Date::now()->toString(Date::DATE_LONG))
20  
-          ->setFieldValue('time',     Date::now()->toString(Date::TIME_LONG))
  20
+          ->setFieldValue('date',     $date->format('Y-m-d'))
  21
+          ->setFieldValue('time',     $date->format('H:i:s'))
21 22
           ->setFieldValue('city',     'Bremen')
22 23
           ->setFieldValue('country',  'Germany');
23 24
 
9  demos/Zend/Service/LiveDocx/MailMerge/pdf-security/generate-document.php
@@ -2,8 +2,7 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Date\Date;
  5
+use DateTime;
7 6
 use Zend\Service\LiveDocx\MailMerge;
8 7
 
9 8
 $mailMerge = new MailMerge();
@@ -17,11 +16,13 @@
17 16
 
18 17
 $mailMerge->setLocalTemplate('template.docx');
19 18
 
  19
+$date = new DateTime();
  20
+
20 21
 $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
21 22
           ->assign('licensee', 'Henry Döner-Meyer')
22 23
           ->assign('company',  'Co-Operation')
23  
-          ->assign('date',     Date::now()->toString(Date::DATE_LONG))
24  
-          ->assign('time',     Date::now()->toString(Date::TIME_LONG))
  24
+          ->assign('date',     $date->format('Y-m-d'))
  25
+          ->assign('time',     $date->format('H:i:s'))
25 26
           ->assign('city',     'Berlin')
26 27
           ->assign('country',  'Germany');
27 28
 
25  demos/Zend/Service/LiveDocx/MailMerge/supported-fonts/show-supported-fonts-cached.php
@@ -2,29 +2,26 @@
2 2
 
3 3
 require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
4 4
 
5  
-
6  
-use Zend\Cache\Cache;
  5
+use Zend\Cache\StorageFactory;
7 6
 use Zend\Service\LiveDocx\Helper;
8 7
 use Zend\Service\LiveDocx\MailMerge;
9 8
 
10 9
 $cacheId = md5(__FILE__);
11 10
 
12  
-$cacheFrontendOptions = array(
13  
-    'lifetime' => 2592000, // 30 days
14  
-    'automatic_serialization' => true
15  
-);
16  
-
17  
-$cacheBackendOptions = array(
18  
-    'cache_dir' => __DIR__ . '/cache'
  11
+$cache = array(
  12
+    'adapter' => 'FileSystem',
  13
+    'options' => array(
  14
+        'cache_dir' => __DIR__ . '/cache',
  15
+    ),
19 16
 );
20 17
 
21  
-if (!is_dir($cacheBackendOptions['cache_dir'])) {
22  
-    mkdir($cacheBackendOptions['cache_dir']);
  18
+if (!is_dir($cache['options']['cache_dir'])) {
  19
+    mkdir($cache['options']['cache_dir']);
23 20
 }
24 21
 
25  
-$cache = Cache::factory('Core', 'File', $cacheFrontendOptions, $cacheBackendOptions);
  22
+$cache = StorageFactory::factory($cache);
26 23
 
27  
-if (! $fonts = $cache->load($cacheId)) {
  24
+if (! $fonts = $cache->getItem($cacheId)) {
28 25
     
29 26
     // Cache miss. Connect to backend service (expensive).
30 27
     
@@ -35,7 +32,7 @@
35 32
     
36 33
     $fonts = $mailMerge->getFontNames();
37 34
     
38  
-    $cache->save($fonts, $cacheId);
  35
+    $cache->addItem($fonts, $cacheId);
39 36
     
40 37
     unset($mailMerge);
41 38
     
25  demos/Zend/Service/LiveDocx/MailMerge/supported-formats/show-supported-formats-cached.php
@@ -2,8 +2,7 @@