Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
sgehrig committed Dec 20, 2010
2 parents 722664e + 4e88b3d commit bebe1bf
Show file tree
Hide file tree
Showing 94 changed files with 2,326 additions and 2,724 deletions.
21 changes: 11 additions & 10 deletions demos/Zend/Service/LiveDocx/Bootstrap.php
@@ -1,23 +1,22 @@
<?php

// Set used namespaces
use Zend\Loader\Autoloader;
use Zend\Locale\Locale;
use Zend\Registry;
use Zend\Service\LiveDocx\Helper;

// Turn up error reporting
error_reporting(E_ALL | E_STRICT);

// Set path to libraries
set_include_path(
__DIR__ . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR .
dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'library'
);
// Set up autoloader
$base = dirname(dirname(dirname(dirname(__DIR__))));
require_once "{$base}/library/Zend/Loader/StandardAutoloader.php";
$loader = new \Zend\Loader\StandardAutoloader();
$loader->registerNamespace('Zend', "{$base}/library/Zend");
$loader->register();

// Set autoloader to autoload libraries
require_once 'Zend/Loader/Autoloader.php';
Autoloader::getInstance();
// Include utility class
require_once "{$base}/demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php";

// Set default locale
Locale::setDefault(Helper::LOCALE);
Expand All @@ -28,4 +27,6 @@
if (false === Helper::credentialsAvailable()) {
Helper::printLine(Helper::credentialsHowTo());
exit();
}
}

unset($base);
Empty file modified demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist 100644 → 100755
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,39 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Date\Date;
use Zend\Service\LiveDocx\MailMerge;

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

/**
* Image Source:
* iStock_000003413016Medium_business-man-with-hands-up.jpg
*/
$photoFilename = 'dailemaitre.jpg';

if (!$mailMerge->imageExists($photoFilename)) {
$mailMerge->uploadImage($photoFilename);
}

$mailMerge->setLocalTemplate('template.docx');

$mailMerge->assign('name', 'Daï Lemaitre')
->assign('company', 'Megasoft Co-operation')
->assign('date', Date::now()->toString(Date::DATE_LONG))
->assign('image:photo', $photoFilename);

$mailMerge->createDocument();

$document = $mailMerge->retrieveDocument('pdf');

file_put_contents('document.pdf', $document);

$mailMerge->deleteImage($photoFilename);

unset($mailMerge);
Binary file not shown.
30 changes: 30 additions & 0 deletions demos/Zend/Service/LiveDocx/MailMerge/images/delete-all.php
@@ -0,0 +1,30 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;

Helper::printLine(
PHP_EOL . 'Deleting All Remotely Stored Images' .
PHP_EOL .
PHP_EOL
);

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

$counter = 1;
foreach ($mailMerge->listImages() as $result) {
printf('%d) %s', $counter, $result['filename']);
$mailMerge->deleteImage($result['filename']);
print(' - DELETED.' . PHP_EOL);
$counter++;
}

print(PHP_EOL);

unset($mailMerge);
31 changes: 31 additions & 0 deletions demos/Zend/Service/LiveDocx/MailMerge/images/download.php
@@ -0,0 +1,31 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;

Helper::printLine(
PHP_EOL . 'Downloading Remotely Stored Images' .
PHP_EOL .
PHP_EOL
);

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

$counter = 1;
foreach ($mailMerge->listImages() as $result) {
printf('%d) %s', $counter, $result['filename']);
$image = $mailMerge->downloadImage($result['filename']);
file_put_contents('downloaded-' . $result['filename'], $image);
print(' - DOWNLOADED.' . PHP_EOL);
$counter++;
}

print(PHP_EOL);

unset($mailMerge);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions demos/Zend/Service/LiveDocx/MailMerge/images/image-exists.php
@@ -0,0 +1,30 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;

Helper::printLine(
PHP_EOL . 'Checking For Remotely Stored Images' .
PHP_EOL .
PHP_EOL
);

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

print('Checking whether an image is available... ');
if (true === $mailMerge->imageExists('image-01.png')) {
print('EXISTS. ');
} else {
print('DOES NOT EXIST. ');
}
print('DONE' . PHP_EOL);

print(PHP_EOL);

unset($mailMerge);
24 changes: 24 additions & 0 deletions demos/Zend/Service/LiveDocx/MailMerge/images/list.php
@@ -0,0 +1,24 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;

Helper::printLine(
PHP_EOL . 'Remotely Stored Images' .
PHP_EOL .
PHP_EOL . 'The following images are currently stored on the LiveDocx server:' .
PHP_EOL .
PHP_EOL
);

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

print(Helper::listDecorator($mailMerge->listImages()));

unset($mailMerge);
30 changes: 30 additions & 0 deletions demos/Zend/Service/LiveDocx/MailMerge/images/upload.php
@@ -0,0 +1,30 @@
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';


use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;

Helper::printLine(
PHP_EOL . 'Uploading Locally Stored Images to Server' .
PHP_EOL .
PHP_EOL
);

$mailMerge = new MailMerge();

$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)
->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);

print('Uploading image... ');
$mailMerge->uploadImage('image-01.png');
print('DONE.' . PHP_EOL);

print('Uploading image... ');
$mailMerge->uploadImage('image-02.png');
print('DONE.' . PHP_EOL);

print(PHP_EOL);

unset($mailMerge);
Expand Up @@ -47,7 +47,7 @@

$formats->template = $mailMerge->getTemplateFormats();
$formats->document = $mailMerge->getDocumentFormats();
$formats->image = $mailMerge->getImageFormats();
$formats->image = $mailMerge->getImageExportFormats();

$cache->save($formats, $cacheId);

Expand Down
Expand Up @@ -26,7 +26,7 @@
Helper::arrayDecorator($mailMerge->getDocumentFormats()), PHP_EOL);

printf("Supported IMAGE file formats (output) : %s%s",
Helper::arrayDecorator($mailMerge->getImageFormats()), PHP_EOL);
Helper::arrayDecorator($mailMerge->getImageExportFormats()), PHP_EOL);

print PHP_EOL;

Expand Down
2 changes: 1 addition & 1 deletion demos/Zend/Service/LiveDocx/check-environment.php
Expand Up @@ -227,7 +227,7 @@

try {
$microtime = microtime(true);
$mailMerge = new Zend_Service_LiveDocx_MailMerge(
$mailMerge = new MailMerge(
array (
'username' => DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME,
'password' => DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD
Expand Down
Empty file.
Expand Up @@ -36,7 +36,7 @@

<programlisting language="php"><![CDATA[
// Use the default blowfish settings
$filter = new Zend_Filter_Decrypt('myencryptionkey');
$filter = new Zend_Filter_Decrypt(array('key' => 'myencryptionkey'));
// Set the vector with which the content was encrypted
$filter->setVector('myvector');
Expand Down
Expand Up @@ -155,7 +155,7 @@ $filter->setAdapter('openssl');

<programlisting language="php"><![CDATA[
// Use the default blowfish settings
$filter = new Zend_Filter_Encrypt('myencryptionkey');
$filter = new Zend_Filter_Encrypt(array('key' => 'myencryptionkey'));
// Set a own vector, otherwise you must call getVector()
// and store this vector for later decryption
Expand Down
Expand Up @@ -31,7 +31,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class License extends \Zend\CodeGenerator\Php\PhpDocblockTag
class LicenseTag extends \Zend\CodeGenerator\Php\PhpDocblockTag
{

/**
Expand All @@ -48,7 +48,7 @@ class License extends \Zend\CodeGenerator\Php\PhpDocblockTag
* fromReflection()
*
* @param \Zend\Reflection\ReflectionDocblockTag $reflectionTagReturn
* @return \Zend\CodeGenerator\Php\Docblock\Tag\License
* @return \Zend\CodeGenerator\Php\Docblock\Tag\LicenseTag
*/
public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $reflectionTagLicense)
{
Expand All @@ -65,7 +65,7 @@ public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $re
* setUrl()
*
* @param string $url
* @return \Zend\CodeGenerator\Php\Docblock\Tag\License
* @return \Zend\CodeGenerator\Php\Docblock\Tag\LicenseTag
*/
public function setUrl($url)
{
Expand Down
Expand Up @@ -31,7 +31,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Param extends \Zend\CodeGenerator\Php\PhpDocblockTag
class ParamTag extends \Zend\CodeGenerator\Php\PhpDocblockTag
{

/**
Expand All @@ -53,7 +53,7 @@ class Param extends \Zend\CodeGenerator\Php\PhpDocblockTag
* fromReflection()
*
* @param \Zend\Reflection\ReflectionDocblockTag $reflectionTagParam
* @return \Zend\CodeGenerator\Php\Docblock\Tag\Param
* @return \Zend\CodeGenerator\Php\Docblock\Tag\ParamTag
*/
public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $reflectionTagParam)
{
Expand All @@ -71,7 +71,7 @@ public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $re
* setDatatype()
*
* @param string $datatype
* @return \Zend\CodeGenerator\Php\Docblock\Tag\Param
* @return \Zend\CodeGenerator\Php\Docblock\Tag\ParamTag
*/
public function setDatatype($datatype)
{
Expand All @@ -93,7 +93,7 @@ public function getDatatype()
* setParamName()
*
* @param string $paramName
* @return \Zend\CodeGenerator\Php\Docblock\Tag\Param
* @return \Zend\CodeGenerator\Php\Docblock\Tag\ParamTag
*/
public function setParamName($paramName)
{
Expand Down
Expand Up @@ -31,7 +31,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Return extends \Zend\CodeGenerator\Php\PhpDocblockTag
class ReturnTag extends \Zend\CodeGenerator\Php\PhpDocblockTag
{

/**
Expand All @@ -48,7 +48,7 @@ class Return extends \Zend\CodeGenerator\Php\PhpDocblockTag
* fromReflection()
*
* @param \Zend\Reflection\ReflectionDocblockTag $reflectionTagReturn
* @return \Zend\CodeGenerator\Php\Docblock\Tag\Return
* @return \Zend\CodeGenerator\Php\Docblock\Tag\ReturnTag
*/
public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $reflectionTagReturn)
{
Expand All @@ -65,7 +65,7 @@ public static function fromReflection(\Zend\Reflection\ReflectionDocblockTag $re
* setDatatype()
*
* @param string $datatype
* @return \Zend\CodeGenerator\Php\Docblock\Tag\Return
* @return \Zend\CodeGenerator\Php\Docblock\Tag\ReturnTag
*/
public function setDatatype($datatype)
{
Expand Down
4 changes: 1 addition & 3 deletions library/Zend/CodeGenerator/Php/PhpDocblockTag.php
Expand Up @@ -26,8 +26,6 @@

/**
* @uses \Zend\CodeGenerator\AbstractCodeGenerator
* @uses \Zend\CodeGenerator\Php\Docblock\Tag\Param
* @uses \Zend\CodeGenerator\Php\Docblock\Tag\Return
* @uses \Zend\Loader\PluginLoader
* @category Zend
* @package Zend_CodeGenerator
Expand All @@ -51,7 +49,7 @@ class PhpDocblockTag extends AbstractPhp
'@<name> <description>'
)
);

/**
* @var string
*/
Expand Down

0 comments on commit bebe1bf

Please sign in to comment.