Skip to content

Commit f59e65b

Browse files
author
Vincent Tsao
committed
Preparing src for release 5.3.0
1 parent 592a945 commit f59e65b

File tree

451 files changed

+226503
-6195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+226503
-6195
lines changed

ChangeLog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
### 5.3.0
2+
3+
AdWords:
4+
- Fixed [pull request #40](https://github.com/googleads/googleads-php-lib/pull/40).
5+
- Fixed [pull request #39](https://github.com/googleads/googleads-php-lib/pull/39).
6+
7+
DFP:
8+
- Deprecated ServiceUtils.php.
9+
- Added support and examples for v201405.
10+
11+
Common:
12+
- OAuth2 credentials are now passed via HTTP headers.
13+
114
### 5.2.3
215

316
AdWords:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ $user->LogDefaults();
123123

124124
// Instantiate the desired service class by calling the get***Service method on
125125
// the AdWordsUser instance.
126-
$campaignService = $user->GetService('CampaignService', 'v201309')
126+
$campaignService = $user->GetService('CampaignService', 'v201309');
127127

128128
// Create data objects and invoke methods on the service class instance. The
129129
// data objects and methods map directly to the data objects and requests for

build_lib/WSDLInterpreter/WSDLInterpreter.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ class WSDLInterpreter
174174
private $package = null;
175175

176176
/**
177-
* Whether or not to enable psuedo namespaces in the generated class names.
177+
* Whether or not to enable namespaces in the generated class names.
178178
* @var string
179179
* @access private
180180
*/
181-
private $enablePseudoNamespaces = null;
181+
private $enableNamespaces = null;
182182

183183
/**
184184
* The class path of the SOAP client to require in the PHP file.
@@ -241,14 +241,14 @@ class WSDLInterpreter
241241
* @param string $soapClientClassPath the class path to require for the
242242
* SOAP client
243243
* @param string $proxy the proxy URL to use when downloading WSDLs
244-
* @param boolean $enablePseudoNamespaces to enable the namespaces
244+
* @param boolean $enableNamespaces to enable the namespaces
245245
* @param array $skipClassNameCheckTypes ignore class name checking list
246246
* @throws WSDLInterpreterException container for all WSDL interpretation
247247
* problems
248248
*/
249249
public function __construct($wsdlUri, $soapClientClassName, $classmap,
250250
$conflictClassmap, $serviceName, $version, $package, $soapClientClassPath,
251-
$proxy, $enablePseudoNamespaces, $skipClassNameCheckTypes)
251+
$proxy, $enableNamespaces, $skipClassNameCheckTypes)
252252
{
253253
// Configure the interpreter
254254
$this->wsdlUri = $wsdlUri;
@@ -258,7 +258,7 @@ public function __construct($wsdlUri, $soapClientClassName, $classmap,
258258
$this->version = $version;
259259
$this->package = $package;
260260
$this->classmap = $classmap ?: $this->classmap;
261-
$this->enablePseudoNamespaces = $enablePseudoNamespaces ?: false;
261+
$this->enableNamespaces = $enableNamespaces ?: false;
262262

263263
$conflictClassmap = $conflictClassmap ?: array();
264264
$this->classmap = array_merge($this->classmap, $conflictClassmap);
@@ -292,7 +292,7 @@ public function __construct($wsdlUri, $soapClientClassName, $classmap,
292292
// Prepare wsdl utility with the loaded settings
293293
$this->utils->setRenameClassMap($this->classmap);
294294
$this->utils->setSkipClassNameCheck($this->skipClassNameCheckTypes);
295-
if ($this->enablePseudoNamespaces) {
295+
if ($this->enableNamespaces) {
296296
$this->utils->setPhpNamespace($this->package);
297297
}
298298
$this->utils->setWsdlNamespaceMap($this->namespaceMap);
@@ -525,7 +525,7 @@ private function generateClassPHP(WsdlElement_Class $class) {
525525
$constructor = $this->generateConstructorPHP($class);
526526

527527
return <<<EOF
528-
if (!class_exists("{$class->getName()}", false)) {
528+
if (!class_exists("{$class->getQuotedFqn()}", false)) {
529529
/**
530530
{$paddedDocs}
531531
* @package {$this->package}
@@ -681,7 +681,7 @@ private function generateServicePHP(WsdlElement_Service $service) {
681681
* @package {$this->package}
682682
* @subpackage {$this->version}
683683
*/
684-
class {$service->getName()} extends {$this->soapClientClassName} {
684+
class {$service->getName()} extends {$this->utils->namespaceName($this->soapClientClassName)} {
685685
686686
const SERVICE_NAME = "{$service->getRawName()}";
687687
const WSDL_NAMESPACE = "{$this->serviceNamespace}";
@@ -740,7 +740,7 @@ private function generateServiceClassmapPHP(WsdlElement_Service $service) {
740740
EOF;
741741
foreach ($this->wsdlClasses as $wsdlClass) {
742742
$return .= sprintf(" \"%s\" => \"%s\",\n", $wsdlClass->getRawName(),
743-
$wsdlClass->getName());
743+
addslashes($wsdlClass->getFqn()));
744744
}
745745
$return .= " );\n\n";
746746

@@ -793,23 +793,20 @@ public function {$rawName}({$functionArgString}) {
793793
* @return array array of source code files that were written out
794794
* @throws WSDLInterpreterException problem in writing out service sources
795795
*/
796-
public function savePHP($outputDirectory)
797-
{
796+
public function savePHP($outputDirectory) {
798797
if (!count($this->servicePHPSources)) {
799798
throw new WSDLInterpreterException("No services loaded");
800799
}
801-
$require = sprintf(
802-
"/** Required classes. **/\nrequire_once \"%s\";\n\n",
803-
$this->soapClientClassPath
804-
);
800+
$namespace = $this->enableNamespaces ? sprintf("namespace %s;\n\n",
801+
$this->utils->getNamespace()) : '';
802+
$require = sprintf("require_once \"%s\";\n\n", $this->soapClientClassPath);
805803
$classSource = join("\n\n", $this->classPHPSources);
806804
$outputFiles = array();
807805
foreach ($this->servicePHPSources as $serviceName => $serviceCode) {
808806
$filename = sprintf('%s/%s.php', $outputDirectory, $serviceName);
809807
$success = file_put_contents($filename, sprintf(
810-
"<?php\n%s\n%s%s\n\n%s",
811-
$this->getFileHeader(), $require, $classSource, $serviceCode
812-
));
808+
"<?php\n%s%s%s%s\n\n%s\n\n", $this->getFileHeader(), $namespace,
809+
$require, $classSource, $serviceCode));
813810
if ($success) {
814811
$outputFiles[] = $filename;
815812
}

build_lib/WSDLInterpreter/WsdlElement/NamedClass.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ abstract class WsdlElement_NamedClass extends WsdlElement_Named {
4444
*/
4545
protected $name;
4646

47+
/**
48+
* Store the fully qualified name with namespace
49+
*/
50+
protected $fqn;
51+
52+
/**
53+
* Store the fully qualified name with namespace, wrapped w/ addslashes.
54+
* e.g., Google\Ads\MyClass => Google\\Ads\\MyClass
55+
*/
56+
protected $quotedFqn;
57+
58+
59+
/**
60+
* Store the PHP namespace, aka package
61+
*/
62+
protected $package;
63+
4764
/**
4865
* An overridden constructor.
4966
*
@@ -69,6 +86,33 @@ public function getName() {
6986
return $this->name;
7087
}
7188

89+
/**
90+
* Returns the fully qualified class name with namespace.
91+
*
92+
* @return string the fully qualified name of the element
93+
*/
94+
public function getFqn() {
95+
return $this->fqn;
96+
}
97+
98+
/**
99+
* Returns the fully qualified class name with namespace.
100+
*
101+
* @return string the fully qualified name of the element
102+
*/
103+
public function getQuotedFqn() {
104+
return $this->quotedFqn;
105+
}
106+
107+
/**
108+
* Returns the PHP namespace.
109+
*
110+
* @return string the PHP namespace
111+
*/
112+
public function getPackage() {
113+
return $this->name;
114+
}
115+
72116
/**
73117
* Get the array of doc lines.
74118
*
@@ -88,6 +132,9 @@ public function getDocs() {
88132
protected function initName() {
89133
$name = $this->getRawName();
90134
$this->name = $this->utils->filterClassName($name);
135+
$this->fqn = $this->utils->namespaceName($this->name);
136+
$this->package = $this->utils->getNamespace();
137+
$this->quotedFqn = addslashes($this->fqn);
91138

92139
return $this;
93140
}

build_lib/WSDLInterpreter/WsdlElement/Utils.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ public function filterClassName($name) {
130130
$filteredName = $this->renameMap[$name];
131131
}
132132
$filteredName = ucfirst($this->getSafePhpName($filteredName));
133-
$filteredName = $this->namespaceName($filteredName);
134133

135134
if (!in_array($filteredName, $this->skipClassList)
136135
&& class_exists($filteredName, false)) {
@@ -148,11 +147,18 @@ public function filterClassName($name) {
148147
*/
149148
public function namespaceName($name) {
150149
if ($this->namespace) {
151-
return sprintf('%s_%s', $this->namespace, $name);
150+
return sprintf('%s\\%s', $this->namespace, $name);
152151
}
153152
return $name;
154153
}
155154

155+
/**
156+
* Get the current namespace) {
157+
*/
158+
public function getNamespace() {
159+
return $this->namespace;
160+
}
161+
156162
public function getWsdlNamespace($name) {
157163
return isset($this->namespaceMap[$name]) ? $this->namespaceMap[$name] :
158164
null;

build_lib/Wsdl2PhpTask.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ class Wsdl2PhpTask extends Task {
7070

7171
/**
7272
* A classmap of 'Wsdl Type => PHP Class' for the WSDL, to be used
73-
* to avoid class name conflicts when pseudo namespaces are not enabled.
73+
* to avoid class name conflicts when namespaces are not enabled.
7474
* @var array the classmap for the WSDL type to PHP class
7575
* @access private
7676
*/
7777
private $conflictClassmap = NULL;
7878

7979
/**
8080
* The WSDL types that shouldn't have their class names checked for
81-
* uniqueness. This option will be ignored when pseudo namespaces are enabled.
81+
* uniqueness. This option will be ignored when namespaces are enabled.
8282
* @var array the WSDL types that shouldn't have their class names checked for
8383
* uniqueness.
8484
* @access private
@@ -114,12 +114,12 @@ class Wsdl2PhpTask extends Task {
114114
private $proxy = NULL;
115115

116116
/**
117-
* Whether or not to enable pseudo namespaces in the generated class names.
118-
* @var boolean whether or not to enable pseudo namespaces in the generated
117+
* Whether or not to enable namespaces in the generated class names.
118+
* @var boolean whether or not to enable namespaces in the generated
119119
* class names
120120
* @access private
121121
*/
122-
private $enablePseudoNamespaces = FALSE;
122+
private $enableNamespaces = FALSE;
123123

124124
/**
125125
* The setter for the attribute <var>$url</var>.
@@ -173,7 +173,7 @@ public function setClassmap($classmap) {
173173
* The setter for the attribute <var>$conflictClassmap</var>.
174174
* @param string $conflictClassmap JSON representation of a classmap, as a
175175
* mapping from WSDL type to PHP class name, to be used to avoid name
176-
* conflicts when pseudo namespaces aren't enabled
176+
* conflicts when namespaces aren't enabled
177177
*/
178178
public function setConflictClassmap($conflictClassmap) {
179179
$this->conflictClassmap = json_decode($conflictClassmap, true);
@@ -221,12 +221,12 @@ public function SetProxy($proxy) {
221221
}
222222

223223
/**
224-
* The setter for the attribute <var>$enablePseudoNamespaces</var>.
225-
* @param boolean $enablePseudoNamespaces whether or not to enable pseudo
224+
* The setter for the attribute <var>$enableNamespaces</var>.
225+
* @param boolean $enableNamespaces whether or not to enable
226226
* namespaces in the generated class names.
227227
*/
228-
public function SetEnablePseudoNamespaces($enablePseudoNamespaces) {
229-
$this->enablePseudoNamespaces = $enablePseudoNamespaces;
228+
public function SetEnableNamespaces($enableNamespaces) {
229+
$this->enableNamespaces = $enableNamespaces;
230230
}
231231

232232
/**
@@ -253,7 +253,7 @@ public function main() {
253253
new WSDLInterpreter($this->url, $this->soapClientClassName,
254254
$this->classmap, $this->conflictClassmap, $this->serviceName,
255255
$this->version, $this->package, $this->soapClientClassPath,
256-
$this->proxy, $this->enablePseudoNamespaces,
256+
$this->proxy, $this->enableNamespaces,
257257
$this->skipClassNameCheckTypes);
258258
$wsdlInterpreter->savePHP($this->outputDir);
259259

build_lib/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<if>
5757
<and>
5858
<isset property="api.soapClientClassNamespace"/>
59-
<not><isfalse value="${wsdl2php.enablePseudoNamespaces}" /></not>
59+
<not><isfalse value="${wsdl2php.enableNamespaces}"/></not>
6060
</and>
6161
<then>
6262
<property name="soapClientClassName"
@@ -79,7 +79,7 @@
7979
soapClientClassName="${soapClientClassName}"
8080
soapClientClassPath="Google/Api/Ads/${product}/Lib/${product}SoapClient.php"
8181
proxy="${wsdl2php.proxy}"
82-
enablePseudoNamespaces="${wsdl2php.enablePseudoNamespaces}"/>
82+
enableNamespaces="${wsdl2php.enableNamespaces}"/>
8383
</target>
8484

8585
</project>

examples/AdWords/Auth/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
error_reporting(E_STRICT | E_ALL);
3030

3131
$depth = '/../../../';
32-
define('SRC_PATH', dirname(__FILE__) . $depth . 'lib/');
32+
define('SRC_PATH', dirname(__FILE__) . $depth . 'src/');
3333
define('LIB_PATH', 'Google/Api/Ads/AdWords/Lib');
3434

3535
// Configure include path.

examples/AdWords/v201309/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
error_reporting(E_STRICT | E_ALL);
3131

3232
$depth = '/../../../';
33-
define('SRC_PATH', dirname(__FILE__) . $depth . 'lib/');
33+
define('SRC_PATH', dirname(__FILE__) . $depth . 'src/');
3434
define('LIB_PATH', 'Google/Api/Ads/AdWords/Lib');
3535
define('UTIL_PATH', 'Google/Api/Ads/Common/Util');
3636
define('ADWORDS_UTIL_PATH', 'Google/Api/Ads/AdWords/Util');

examples/AdWords/v201402/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
error_reporting(E_STRICT | E_ALL);
3131

3232
$depth = '/../../../';
33-
define('SRC_PATH', dirname(__FILE__) . $depth . 'lib/');
33+
define('SRC_PATH', dirname(__FILE__) . $depth . 'src/');
3434
define('LIB_PATH', 'Google/Api/Ads/AdWords/Lib');
3535
define('UTIL_PATH', 'Google/Api/Ads/Common/Util');
3636
define('ADWORDS_UTIL_PATH', 'Google/Api/Ads/AdWords/Util');

0 commit comments

Comments
 (0)