Skip to content

Commit ffdfa52

Browse files
committed
write some GDATA stuff in working place
1 parent b5830a6 commit ffdfa52

File tree

11 files changed

+191
-29
lines changed

11 files changed

+191
-29
lines changed

app/AppKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function registerBundles()
1919
new JMS\AopBundle\JMSAopBundle(),
2020
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
2121
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
22+
new Google\OauthBundle\GoogleOauthBundle(),
2223
);
2324

2425
if (in_array($this->getEnvironment(), array('dev', 'test'))) {

app/config/routing.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
GoogleOauthBundle:
2+
resource: "@GoogleOauthBundle/Controller/"
3+
type: annotation
4+
prefix: /
5+
16
# Internal routing configuration to handle ESI
27
#_internal:
38
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"sensio/generator-bundle": "dev-master",
1919
"jms/security-extra-bundle": "1.1.*",
2020
"jms/di-extra-bundle": "1.0.*",
21-
"doctrine/data-fixtures": "*"
21+
"doctrine/data-fixtures": "*",
22+
"zend/gdata": "*"
2223
},
2324
"scripts": {
2425
"post-install-cmd": [

composer.lock

Lines changed: 36 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace Google\OauthBundle\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
8+
9+
class DefaultController extends Controller
10+
{
11+
12+
const domain = 'testGoogle.au';
13+
14+
protected $email = '[email protected]';
15+
protected $password = '123456qqq';
16+
protected $username = 'cp3';
17+
protected $givenname = 'nima';
18+
protected $familyname = 'heiA';
19+
protected $password_c = '12345694';
20+
21+
/**
22+
* @Route("/hello/{name}")
23+
* @Template()
24+
*/
25+
public function indexAction($name)
26+
{
27+
// $clientLibPath = 'C:\wamp\www\monSymfony2\vendor\Zend\gdata\library';
28+
// $exe = set_include_path(get_include_path().PATH_SEPARATOR.$clientLibPath);
29+
// $config = array(
30+
// 'adapter' => 'Zend_Http_Client_Adapter_Proxy',
31+
// 'proxy' => 'localhost',
32+
// 'proxy_port' => 3128
33+
// );
34+
// $proxiedHttpClient = new \Zend_Http_Client( 'http://www.google.com:443', $config );
35+
36+
$client = \Zend_Gdata_ClientLogin::getHttpClient( $this->email, $this->password, \Zend_Gdata_Gapps::AUTH_SERVICE_NAME );
37+
// $service = new \Zend_Gdata_Gapps( $client, self::domain );
38+
// $service->createUser( $this->username, $this->givenname, $this->familyname, $this->password_c, $passwordHashFunction = null, $quota = null );
39+
40+
return array('name' => $name);
41+
}
42+
43+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Google\OauthBundle\DependencyInjection;
4+
5+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6+
use Symfony\Component\Config\Definition\ConfigurationInterface;
7+
8+
/**
9+
* This is the class that validates and merges configuration from your app/config files
10+
*
11+
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12+
*/
13+
class Configuration implements ConfigurationInterface
14+
{
15+
/**
16+
* {@inheritDoc}
17+
*/
18+
public function getConfigTreeBuilder()
19+
{
20+
$treeBuilder = new TreeBuilder();
21+
$rootNode = $treeBuilder->root('google_oauth');
22+
23+
// Here you should define the parameters that are allowed to
24+
// configure your bundle. See the documentation linked above for
25+
// more information on that topic.
26+
27+
return $treeBuilder;
28+
}
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Google\OauthBundle\DependencyInjection;
4+
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\Config\FileLocator;
7+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8+
use Symfony\Component\DependencyInjection\Loader;
9+
10+
/**
11+
* This is the class that loads and manages your bundle configuration
12+
*
13+
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14+
*/
15+
class GoogleOauthExtension extends Extension
16+
{
17+
/**
18+
* {@inheritDoc}
19+
*/
20+
public function load(array $configs, ContainerBuilder $container)
21+
{
22+
$configuration = new Configuration();
23+
$config = $this->processConfiguration($configuration, $configs);
24+
25+
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26+
$loader->load('services.xml');
27+
}
28+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Google\OauthBundle;
4+
5+
use Symfony\Component\HttpKernel\Bundle\Bundle;
6+
7+
class GoogleOauthBundle extends Bundle
8+
{
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<!--
8+
<parameters>
9+
<parameter key="google_oauth.example.class">Google\OauthBundle\Example</parameter>
10+
</parameters>
11+
12+
<services>
13+
<service id="google_oauth.example" class="%google_oauth.example.class%">
14+
<argument type="service" id="service_id" />
15+
<argument>plain_value</argument>
16+
<argument>%parameter_name%</argument>
17+
</service>
18+
</services>
19+
-->
20+
</container>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello {{ name }}!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Google\OauthBundle\Tests\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6+
7+
class DefaultControllerTest extends WebTestCase
8+
{
9+
public function testIndex()
10+
{
11+
$client = static::createClient();
12+
13+
$crawler = $client->request('GET', '/hello/Fabien');
14+
15+
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
16+
}
17+
}

0 commit comments

Comments
 (0)