| Server IP : 69.39.225.240 / Your IP : 216.73.216.138 Web Server : Apache System : Linux bronze7.serverhost.net 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : reademotions ( 1074) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/reademotions/www/wp-content/plugins/loco-translate/src/data/ |
Upload File : |
<?php
/**
* Static, read-only caching of data held in serialized files.
* Used for pre-built arrays of information such as plural forms.
*/
class Loco_data_CompiledData implements ArrayAccess, Countable, IteratorAggregate {
/**
* @var array
*/
private static $reg;
/**
* @var string
*/
private $name;
/**
* @var array
*/
private $data;
/**
* @param string
* @return Loco_data_CompiledData
*/
public static function get( $name ){
if( ! isset(self::$reg[$name]) ){
self::$reg[$name] = new Loco_data_CompiledData($name);
}
return self::$reg[$name];
}
private function __construct( $name ){
$path = 'lib/data/'.$name.'.php';
$this->data = loco_include( $path );
$this->name = $name;
}
public function destroy(){
unset( self::$reg[$this->name], $this->data );
}
#[ReturnTypeWillChange]
public function offsetGet( $k ){
return isset($this->data[$k]) ? $this->data[$k] : null;
}
#[ReturnTypeWillChange]
public function offsetExists( $k ){
return isset($this->data[$k]);
}
#[ReturnTypeWillChange]
public function offsetUnset( $k ){
throw new RuntimeException('Read only');
}
#[ReturnTypeWillChange]
public function offsetSet( $k, $v ){
throw new RuntimeException('Read only');
}
#[ReturnTypeWillChange]
public function count(){
return count($this->data);
}
/**
* Implements IteratorAggregate::getIterator
* @return ArrayIterator
*/
#[ReturnTypeWillChange]
public function getIterator(){
return new ArrayIterator( $this->data );
}
}