Skip to content

Commit

Permalink
Preparing src for release 5.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Tsao committed Apr 1, 2014
1 parent 885826a commit 37de7b0
Show file tree
Hide file tree
Showing 338 changed files with 1,198,305 additions and 1,167,143 deletions.
16 changes: 15 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
### 5.2.2

AdWords:
- Fixed [issue #21](https://github.com/googleads/googleads-php-lib/issues/21).

DFP:
- Fixed [pull request #18](https://github.com/googleads/googleads-php-lib/pull/18 "googleads-php-lib pull request #18").

Common:
- Fixed [issue #24](https://github.com/googleads/googleads-php-lib/issues/24 "googleads-php-lib issue #24").
- Fixed [issue #10](https://github.com/googleads/googleads-php-lib/issues/10).
- Fixed [pull request #11](https://github.com/googleads/googleads-php-lib/pull/11 "googleads-php-lib pull request #11").

### 5.2.1

AdWords:
- Added support and examples for v201402.
- Added exception being thrown if a service is requested with ClientLogin as
Expand Down Expand Up @@ -32,7 +46,7 @@ Common:
### 5.1.0

AdWords:
- Fixing [issue #9](https://github.com/googleads/googleads-php-lib/issues/9 "googleads-php-lib issues #9") - removing unused criteria object in example.
- Fixed [issue #9](https://github.com/googleads/googleads-php-lib/issues/9 "googleads-php-lib issue #9") - removing unused criteria object in example.
- Added support for AdWords Express for v201309 (invite-only feature).

DFP:
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project hosts the PHP client library for the various SOAP-based Ads APIs
* Automatic handling of SOAP headers.
* Easy management of credentials, authentication, and session information.
* Examples to that show how to access API services.
* PHPDoc - [AdWords](http://googleads.github.io/googleads-php-lib/AdWords/),
[DFP](http://googleads.github.io/googleads-php-lib/Dfp/)


### Requirements
Expand Down Expand Up @@ -38,6 +40,13 @@ Developers page](https://plus.google.com/+GoogleAdsDevelopers/posts) and our
[Google Ads Developers blog](http://googleadsdeveloper.blogspot.com).


### Support forum

If you have questions about the client library or the APIs, you can ask them on our forums:
* [AdWords API Forum](https://groups.google.com/group/adwords-api)
* [DoubleClick for Publishers API Forum](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api)
* [DoubleClick Ad Exchange Buyer API Forum](https://groups.google.com/forum/#!forum/google-doubleclick-ad-exchange-buyer-api)

### Getting started

1\. Register an OAuth 2 application.
Expand Down Expand Up @@ -102,7 +111,7 @@ products.
// $path = '/path/to/pda_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/AdWordsUser/Lib/AdWordsUser.php';
require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php';

// Create an AdWordsUser instance using the default constructor, which will load
// information from the auth.ini file as described above.
Expand Down
209 changes: 105 additions & 104 deletions build_lib/WSDLInterpreter/WSDLInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ protected function loadWsdl($wsdlUri, $proxy = null) {
$opts = array(
'http' => array(
'proxy' => $proxy,
'request_fulluri' => TRUE
'request_fulluri' => true
)
);
$context = stream_context_get_default($opts);
Expand Down Expand Up @@ -514,7 +514,7 @@ protected function generateSources($wsdlClasses, $wsdlServices) {
* @return string the php source code for the message type class
*/
private function generateClassPHP(WsdlElement_Class $class) {
$paddedDocs = implode("\n", $this->utils->padDocs($class->getDocs(), 0));
$paddedDocs = implode("\n", $this->utils->padDocs($class->getDocs(), 2));
$extends = "";
$ext = $class->getExtends();
if ($extendsClass = $class->getExtends()) {
Expand All @@ -525,35 +525,36 @@ private function generateClassPHP(WsdlElement_Class $class) {
$constructor = $this->generateConstructorPHP($class);

return <<<EOF
if (!class_exists("{$class->getName()}", FALSE)) {
/**
if (!class_exists("{$class->getName()}", false)) {
/**
{$paddedDocs}
* @package {$this->package}
* @subpackage {$this->version}
*/
class {$class->getName()}{$extends} {
* @package {$this->package}
* @subpackage {$this->version}
*/
class {$class->getName()}{$extends} {
const WSDL_NAMESPACE = "{$class->getWsdlNamespace()}";
const XSI_TYPE = "{$class->getXsiTypeName()}";
const WSDL_NAMESPACE = "{$class->getWsdlNamespace()}";
const XSI_TYPE = "{$class->getXsiTypeName()}";
{$properties}
/**
* Gets the namesapce of this class
* @return the namespace of this class
*/
public function getNamespace() {
return self::WSDL_NAMESPACE;
}
/**
* Gets the namesapce of this class
* @return the namespace of this class
*/
public function getNamespace() {
return self::WSDL_NAMESPACE;
}
/**
* Gets the xsi:type name of this class
* @return the xsi:type name of this class
*/
public function getXsiTypeName() {
return self::XSI_TYPE;
}
/**
* Gets the xsi:type name of this class
* @return the xsi:type name of this class
*/
public function getXsiTypeName() {
return self::XSI_TYPE;
}
{$constructor}
}}
}
}
EOF;
}

Expand All @@ -578,42 +579,42 @@ private function generatePropertiesPHP($properties) {
if (!count($changedProperties)) {
return $return;
}
$return .= " private \$_parameterMap = array(\n";
$return .= " private \$_parameterMap = array(\n";
foreach ($changedProperties as $property) {
$return .= sprintf(" \"%s\" => \"%s\",\n", $property->getRawName(),
$return .= sprintf(" \"%s\" => \"%s\",\n", $property->getRawName(),
$property->getName());
}
return $return . <<<EOF
);
);
/**
* Provided for setting non-php-standard named variables
* @param \$var Variable name to set
* @param \$value Value to set
*/
public function __set(\$var, \$value) {
\$this->{\$this->_parameterMap[\$var]} = \$value;
}
/**
* Provided for setting non-php-standard named variables
* @param \$var Variable name to set
* @param \$value Value to set
*/
public function __set(\$var, \$value) {
\$this->{\$this->_parameterMap[\$var]} = \$value;
}
/**
* Provided for getting non-php-standard named variables
* @param \$var Variable name to get
* @return mixed Variable value
*/
public function __get(\$var) {
if (!isset(\$this->_parameterMap[\$var])) {
return null;
/**
* Provided for getting non-php-standard named variables
* @param \$var Variable name to get
* @return mixed Variable value
*/
public function __get(\$var) {
if (!isset(\$this->_parameterMap[\$var])) {
return null;
}
return \$this->{\$this->_parameterMap[\$var]};
}
return \$this->{\$this->_parameterMap[\$var]};
}
/**
* Provided for getting non-php-standard named variables
* @return array parameter map
*/
protected function getParameterMap() {
return \$this->_parameterMap;
}
/**
* Provided for getting non-php-standard named variables
* @return array parameter map
*/
protected function getParameterMap() {
return \$this->_parameterMap;
}
EOF;
}
Expand All @@ -632,16 +633,16 @@ private function generateConstructorPHP(WsdlElement_Class $class) {
$argNames[] = "{$property->getVarName()} = null";
}
$args = implode(", ", $argNames);
$constructor = " public function __construct($args) {\n";
$constructor = " public function __construct($args) {\n";

if ($class->hasParent()) {
$constructor .= " parent::__construct();\n";
$constructor .= " parent::__construct();\n";
}
foreach ($class->getAllProperties() as $property) {
$constructor .= " \$this->{$property->getName()} = "
$constructor .= " \$this->{$property->getName()} = "
. "{$property->getVarName()};\n";
}
return $constructor . " }\n";
return $constructor . " }\n";
}

/**
Expand All @@ -653,11 +654,11 @@ private function generateConstructorPHP(WsdlElement_Class $class) {
private function generatePropertyPHP(WsdlElement_Property $property) {
return <<<EOF
/**
* @access public
* @var {$property->getType()}
*/
public {$property->getVarName()};
/**
* @access public
* @var {$property->getType()}
*/
public {$property->getVarName()};
EOF;
}
Expand All @@ -674,46 +675,46 @@ private function generatePropertyPHP(WsdlElement_Property $property) {
*/
private function generateServicePHP(WsdlElement_Service $service) {
$return = <<<EOF
if (!class_exists("{$service->getName()}", FALSE)) {
/**
* {$service->getName()}
* @package {$this->package}
* @subpackage {$this->version}
*/
class {$service->getName()} extends {$this->soapClientClassName} {
const SERVICE_NAME = "{$service->getRawName()}";
const WSDL_NAMESPACE = "{$this->serviceNamespace}";
const ENDPOINT = "{$service->getEndpoint()}";
if (!class_exists("{$service->getName()}", false)) {
/**
* The endpoint of the service
* @var string
* {$service->getName()}
* @package {$this->package}
* @subpackage {$this->version}
*/
public static \$endpoint = "{$service->getEndpoint()}";
class {$service->getName()} extends {$this->soapClientClassName} {
const SERVICE_NAME = "{$service->getRawName()}";
const WSDL_NAMESPACE = "{$this->serviceNamespace}";
const ENDPOINT = "{$service->getEndpoint()}";
/**
* The endpoint of the service
* @var string
*/
public static \$endpoint = "{$service->getEndpoint()}";
EOF;
$return .= $this->generateServiceClassmapPHP($service);

$return .= <<<EOF
/**
* Constructor using wsdl location and options array
* @param string \$wsdl WSDL location for this service
* @param array \$options Options for the SoapClient
*/
public function __construct(\$wsdl=null, \$options, \$user) {
\$options["classmap"] = self::\$classmap;
parent::__construct(\$wsdl, \$options, \$user, self::SERVICE_NAME,
self::WSDL_NAMESPACE);
}
/**
* Constructor using wsdl location and options array
* @param string \$wsdl WSDL location for this service
* @param array \$options Options for the SoapClient
*/
public function __construct(\$wsdl, \$options, \$user) {
\$options["classmap"] = self::\$classmap;
parent::__construct(\$wsdl, \$options, \$user, self::SERVICE_NAME,
self::WSDL_NAMESPACE);
}
EOF;

foreach ($service->getFunctions() as $wsdlFunction) {
$return .= $this->generateServiceFunctionPHP($wsdlFunction);
}
$return .= "}}";
$return .= " }\n}";
return $return;
}

Expand All @@ -729,19 +730,19 @@ private function generateServiceClassmapPHP(WsdlElement_Service $service) {
return $return;
}
$return .= <<<EOF
/**
* Default class map for wsdl=>php
* @access private
* @var array
*/
public static \$classmap = array(
/**
* Default class map for wsdl=>php
* @access private
* @var array
*/
public static \$classmap = array(
EOF;
foreach ($this->wsdlClasses as $wsdlClass) {
$return .= sprintf(" \"%s\" => \"%s\",\n", $wsdlClass->getRawName(),
$return .= sprintf(" \"%s\" => \"%s\",\n", $wsdlClass->getRawName(),
$wsdlClass->getName());
}
$return .= " );\n\n";
$return .= " );\n\n";

return $return;
}
Expand All @@ -759,7 +760,7 @@ private function generateServiceClassmapPHP(WsdlElement_Service $service) {
private function generateServiceFunctionPHP(
WsdlElement_Function $wsdlFunction) {
$funcDocs = implode("\n", $this->utils->padDocs(
$wsdlFunction->getDocs(), 2));
$wsdlFunction->getDocs(), 4));

$functionArgs = array();
foreach ($wsdlFunction->getProperties() as $property) {
Expand All @@ -769,14 +770,14 @@ private function generateServiceFunctionPHP(

$rawName = $wsdlFunction->getRawName();
return <<<EOF
/**
/**
{$funcDocs}
*/
public function {$rawName}({$functionArgString}) {
\$args = new {$wsdlFunction->getName()}({$functionArgString});
\$result = \$this->__soapCall("{$rawName}", array(\$args));
return \$result->rval;
}
*/
public function {$rawName}({$functionArgString}) {
\$args = new {$wsdlFunction->getName()}({$functionArgString});
\$result = \$this->__soapCall("{$rawName}", array(\$args));
return \$result->rval;
}
EOF;
}
Expand Down
2 changes: 1 addition & 1 deletion build_lib/WSDLInterpreter/WsdlElement/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function filterDocLine($line) {
public function padDocs($docs, $pad = 2) {
$paddedDocs = array();
foreach ($docs as $line) {
$paddedDocs[] = str_pad('', $pad) . $line;
$paddedDocs[] = str_pad(' ', $pad) . $line;
}
return $paddedDocs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function GetAccountHierarchyExample(AdWordsUser $user) {
function DisplayAccountTree($account, $link, $accounts, $links, $depth) {
print str_repeat('-', $depth * 2);
printf("%s, %s\n", $account->customerId,
!empty($link->descriptiveName) ? $link->descriptiveName :$account->login);
!empty($link->name) ? $link->name :$account->login);
if (array_key_exists($account->customerId, $links)) {
foreach ($links[$account->customerId] as $childLink) {
$childAccount = $accounts[$childLink->clientCustomerId];
Expand Down
Loading

0 comments on commit 37de7b0

Please sign in to comment.