Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/staging' into JGithubLabels
Browse files Browse the repository at this point in the history
  • Loading branch information
nprasath002 committed Oct 13, 2012
2 parents 534b55b + 92b45de commit 2f27110
Show file tree
Hide file tree
Showing 54 changed files with 11,262 additions and 56 deletions.
2 changes: 2 additions & 0 deletions docs/manual/en-US/chapters/packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

<xi:include href="packages/github.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />

<xi:include href="packages/google.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />

<xi:include href="packages/http.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />

<xi:include href="packages/input.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Expand Down
95 changes: 95 additions & 0 deletions docs/manual/en-US/chapters/packages/google.xml
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-&gt;set('clientid', 'google_client_id.apps.googleusercontent.com');
$options-&gt;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-&gt;data('calendar');</programlisting> or <programlisting>$analytics = $google-&gt;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-&gt;set('clientid', 'google_client_id.apps.googleusercontent.com');
$options-&gt;set('clientsecret', 'google_client_secret');
$options-&gt;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>
2 changes: 1 addition & 1 deletion libraries/joomla/crypt/password/simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function getSalt($length)
{
$bytes = ceil($length * 6 / 8);

$randomData = str_replace('+', '.', base64_encode(JCrypt::getRandomBytes($bytes)));
$randomData = str_replace('+', '.', base64_encode(JCrypt::genRandomBytes($bytes)));

return substr($randomData, 0, $length);
}
Expand Down
26 changes: 25 additions & 1 deletion libraries/joomla/form/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,24 @@ abstract class JFormField
*/
protected $required = false;

/**
* The disabled state for the form field. If true then there must not be a possibility
* to change the pre-selected value, and the value must not be submitted by the browser.
*
* @var boolean
* @since 12.3
*/
protected $disabled = false;

/**
* The readonly state for the form field. If true then there must not be a possibility
* to change the pre-selected value, and the value must submitted by the browser.
*
* @var boolean
* @since 12.3
*/
protected $readonly = false;

/**
* The form field type.
*
Expand Down Expand Up @@ -240,6 +258,8 @@ public function __get($name)
case 'multiple':
case 'name':
case 'required':
case 'disabled':
case 'readonly':
case 'type':
case 'validate':
case 'value':
Expand Down Expand Up @@ -324,9 +344,13 @@ public function setup(SimpleXMLElement $element, $value, $group = null)
$multiple = (string) $element['multiple'];
$name = (string) $element['name'];
$required = (string) $element['required'];
$disabled = (string) $element['disabled'];
$readonly = (string) $element['readonly'];

// Set the required and validation options.
// Set the required, disabled and validation options.
$this->required = ($required == 'true' || $required == 'required' || $required == '1');
$this->disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
$this->readonly = ($readonly == 'true' || $readonly == 'readonly' || $readonly == '1');
$this->validate = (string) $element['validate'];

// Add the required class if the field is required.
Expand Down
15 changes: 15 additions & 0 deletions libraries/joomla/github/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ class JGithub
*/
protected $commits;

/**
* @var JGithubMilestones GitHub API object for milestones.
* @since 12.3
*/
protected $milestones;

/**
* Constructor.
*
Expand Down Expand Up @@ -154,6 +160,15 @@ public function __get($name)
}
return $this->commits;
}

if ($name == 'milestones')
{
if ($this->milestones == null)
{
$this->milestones = new JGithubMilestones($this->options, $this->client);
}
return $this->milestones;
}
}

/**
Expand Down
Loading

0 comments on commit 2f27110

Please sign in to comment.