forked from joomla/joomla-platform
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/staging' into JGithubLabels
- Loading branch information
Showing
54 changed files
with
11,262 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ | ||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Developer_Manual.ent"> | ||
%BOOK_ENTITIES; | ||
]> | ||
<section id="chap-Joomla_Platform_Manual-Google"> | ||
<title>The Google Package</title> | ||
|
||
<section> | ||
<title>Using the Google Package</title> | ||
|
||
<para>The Google package is designed to be a straightforward interface for working with various Google APIs. You can find a list of APIs and documentation for each API at <ulink | ||
url="https://developers.google.com/products/">https://developers.google.com/products/.</ulink></para> | ||
|
||
<section> | ||
<title>Instantiating JGoogle</title> | ||
|
||
<para>Instantiating JGoogle is easy:</para> | ||
|
||
<programlisting>$google = new JGoogle;</programlisting> | ||
|
||
<para>This creates a generic JGoogle object that can be used to instantiate objects for specific Google APIs.</para> | ||
|
||
<para>Sometimes it is necessary to specify additional options. This can be done by injecting in a JRegistry object with your | ||
preferred options:<programlisting>$options = new JRegistry; | ||
$options->set('clientid', 'google_client_id.apps.googleusercontent.com'); | ||
$options->set('clientsecret', 'google_client_secret'); | ||
|
||
$google = new JGoogle($options);</programlisting></para> | ||
</section> | ||
|
||
<section> | ||
<title>Accessing the JGoogle APIs</title> | ||
|
||
<para>The Google Package divides APIs into two types: data APIs and embed APIs. Data APIs use JHttp to send and receive data from Google. | ||
Embed APIs output HTML, JavaScript, and XML in order to embed information from Google in a webpage.</para> | ||
|
||
<para>The Google package is still incomplete, but there are five object APIs that have currently been | ||
implemented:</para> | ||
|
||
<para>Data: <simplelist> | ||
<member>Google Calendar</member> | ||
|
||
<member>Google AdSense</member> | ||
|
||
<member>Google Picasa</member> | ||
</simplelist></para> | ||
|
||
<para>Data: <simplelist> | ||
<member>Google Maps</member> | ||
|
||
<member>Google Analytics</member> | ||
</simplelist></para> | ||
|
||
<para>Once a JGoogle object has been created, it is simple to use it to create objects for each individual API:<programlisting>$calendar = $google->data('calendar');</programlisting> or <programlisting>$analytics = $google->data('analytics');</programlisting></para> | ||
</section> | ||
|
||
<section> | ||
<title>Using an API</title> | ||
|
||
<para>See below for an example demonstrating the use of the Calendar API:<programlisting>$options = new JRegistry; | ||
|
||
// Client ID and Client Secret can be obtained through the Google API Console (https://code.google.com/apis/console/). | ||
$options->set('clientid', 'google_client_id.apps.googleusercontent.com'); | ||
$options->set('clientsecret', 'google_client_secret'); | ||
$options->set('redirecturi', JURI::current()); | ||
|
||
$google = new JGoogle($options); | ||
|
||
// Get a calendar API object | ||
$calendar = $google->data('calendar'); | ||
|
||
// If the client hasn't been authenticated via OAuth yet, redirect to the appropriate URL and terminate the program | ||
if (!$calendar->isAuth()) | ||
{ | ||
JResponse::sendHeaders(); | ||
die(); | ||
} | ||
|
||
// Create a new Google Calendar called "Hello World." | ||
$calendar->createCalendar('Hello World');</programlisting></para> | ||
</section> | ||
|
||
<section> | ||
<title>More Information</title> | ||
|
||
<para>The following resources contain more information:<simplelist> | ||
<member><ulink url="http://api.joomla.org">Joomla! API Reference</ulink></member> | ||
|
||
<member><ulink url="https://developers.google.com/">Google Developers Homepage</ulink></member> | ||
</simplelist></para> | ||
</section> | ||
</section> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.