Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../includes/Google
File: Collection.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if (!class_exists('UDP_Google_Client')) {
[2] Fix | Delete
require_once dirname(__FILE__) . '/../autoload.php';
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Extension to the regular Google_Model that automatically
[7] Fix | Delete
* exposes the items array for iteration, so you can just
[8] Fix | Delete
* iterate over the object rather than a reference inside.
[9] Fix | Delete
*/
[10] Fix | Delete
class Google_Collection extends Google_Model implements Iterator, Countable
[11] Fix | Delete
{
[12] Fix | Delete
protected $collection_key = 'items';
[13] Fix | Delete
[14] Fix | Delete
public function rewind()
[15] Fix | Delete
{
[16] Fix | Delete
if (isset($this->modelData[$this->collection_key])
[17] Fix | Delete
&& is_array($this->modelData[$this->collection_key])) {
[18] Fix | Delete
reset($this->modelData[$this->collection_key]);
[19] Fix | Delete
}
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public function current()
[23] Fix | Delete
{
[24] Fix | Delete
$this->coerceType($this->key());
[25] Fix | Delete
if (is_array($this->modelData[$this->collection_key])) {
[26] Fix | Delete
return current($this->modelData[$this->collection_key]);
[27] Fix | Delete
}
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
public function key()
[31] Fix | Delete
{
[32] Fix | Delete
if (isset($this->modelData[$this->collection_key])
[33] Fix | Delete
&& is_array($this->modelData[$this->collection_key])) {
[34] Fix | Delete
return key($this->modelData[$this->collection_key]);
[35] Fix | Delete
}
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function next()
[39] Fix | Delete
{
[40] Fix | Delete
return next($this->modelData[$this->collection_key]);
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
public function valid()
[44] Fix | Delete
{
[45] Fix | Delete
$key = $this->key();
[46] Fix | Delete
return $key !== null && $key !== false;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
public function count()
[50] Fix | Delete
{
[51] Fix | Delete
if (!isset($this->modelData[$this->collection_key])) {
[52] Fix | Delete
return 0;
[53] Fix | Delete
}
[54] Fix | Delete
return count($this->modelData[$this->collection_key]);
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
public function offsetExists ($offset)
[58] Fix | Delete
{
[59] Fix | Delete
if (!is_numeric($offset)) {
[60] Fix | Delete
return parent::offsetExists($offset);
[61] Fix | Delete
}
[62] Fix | Delete
return isset($this->modelData[$this->collection_key][$offset]);
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
public function offsetGet($offset)
[66] Fix | Delete
{
[67] Fix | Delete
if (!is_numeric($offset)) {
[68] Fix | Delete
return parent::offsetGet($offset);
[69] Fix | Delete
}
[70] Fix | Delete
$this->coerceType($offset);
[71] Fix | Delete
return $this->modelData[$this->collection_key][$offset];
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
public function offsetSet($offset, $value)
[75] Fix | Delete
{
[76] Fix | Delete
if (!is_numeric($offset)) {
[77] Fix | Delete
return parent::offsetSet($offset, $value);
[78] Fix | Delete
}
[79] Fix | Delete
$this->modelData[$this->collection_key][$offset] = $value;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
public function offsetUnset($offset)
[83] Fix | Delete
{
[84] Fix | Delete
if (!is_numeric($offset)) {
[85] Fix | Delete
return parent::offsetUnset($offset);
[86] Fix | Delete
}
[87] Fix | Delete
unset($this->modelData[$this->collection_key][$offset]);
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
private function coerceType($offset)
[91] Fix | Delete
{
[92] Fix | Delete
$typeKey = $this->keyType($this->collection_key);
[93] Fix | Delete
if (isset($this->$typeKey) && !is_object($this->modelData[$this->collection_key][$offset])) {
[94] Fix | Delete
$type = $this->$typeKey;
[95] Fix | Delete
$this->modelData[$this->collection_key][$offset] =
[96] Fix | Delete
new $type($this->modelData[$this->collection_key][$offset]);
[97] Fix | Delete
}
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function