SimplePie_Registry::create() public WP 1.0
Create a new instance of a given type
{} Это метод класса: SimplePie_Registry{}
Хуков нет.
Возвращает
Объект
. Instance of class
Использование
$SimplePie_Registry = new SimplePie_Registry(); $SimplePie_Registry->&create( $type, $parameters );
- $type(строка) (обязательный)
- -
- $parameters(массив)
- Parameters to pass to the constructor
Код SimplePie_Registry::create() SimplePie Registry::create WP 5.7.1
public function &create($type, $parameters = array())
{
$class = $this->get_class($type);
if (in_array($class, $this->legacy))
{
switch ($type)
{
case 'locator':
// Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class
// Specified: file, timeout, useragent, max_checked_feeds
$replacement = array($this->get_class('file'), $parameters[3], $this->get_class('content_type_sniffer'));
array_splice($parameters, 3, 1, $replacement);
break;
}
}
if (!method_exists($class, '__construct'))
{
$instance = new $class;
}
else
{
$reflector = new ReflectionClass($class);
$instance = $reflector->newInstanceArgs($parameters);
}
if (method_exists($instance, 'set_registry'))
{
$instance->set_registry($this);
}
return $instance;
}