本文整理汇总了PHP中Item::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::__construct方法的具体用法?PHP Item::__construct怎么用?PHP Item::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($meta = 0, $count = 1)
{
parent::__construct(self::COAL, $meta, $count, "Coal");
if ($this->meta === 1) {
$this->name = "Charcoal";
}
}
示例2: __construct
public function __construct($variableName, $type, $title)
{
parent::__construct();
$this->variableName = $variableName;
$this->type = $type;
$this->title = $title;
}
示例3: __construct
public function __construct($id = false, $style_sd = false)
{
global $bd_names, $site_ways;
parent::__construct($id, ItemType::Skin, $bd_names['sp_skins'], $style_sd);
$this->base_dir = MCR_ROOT . $site_ways['sp_dir'] . 'skins/';
$this->base_url = $site_ways['sp_dir'] . 'skins/';
$this->db_likes = $bd_names['likes'];
$this->db_bad_skins = $bd_names['sp_bad_skins'];
$this->db_ratio = $bd_names['sp_skins_ratio'];
if (!$this->id) {
return;
}
$line = getDB()->fetchRow("SELECT * FROM `{$this->db}` WHERE `id`='" . $this->id . "'");
if (!$line) {
return;
}
$this->name = $line['name'];
$this->fname = $line['fname'];
$this->fsize = $line['fsize'];
$this->dislikes = (int) $line['dislikes'];
$this->likes = (int) $line['likes'];
$this->ratio = (int) $line['ratio'];
// @todo rename to scale
$this->gender = (int) $line['gender'];
$this->downloads = (int) $line['downloads'];
$this->comments = (int) $line['comments'];
$this->user_id = (int) $line['user_id'];
$this->comment_last = $line['comment_last'] === '0000-00-00 00:00:00' ? false : $line['comment_last'];
}
示例4: __construct
public function __construct($name, array $data)
{
parent::__construct($name, $data);
foreach ($data['values'] as $value) {
$this->values[] = new AspectValue($value['name'], $value);
}
}
示例5: __construct
/**
* Create a property, either from server data or locally
*
* To indicate a property has newly been created locally, make sure to pass
* true for the $new parameter.
*
* @param object $factory an object factory implementing "get" as described in \jackalope\Factory
* @param array $data array with fields
* type (integer or string from PropertyType)
* and value (data for creating value object - array for multivalue property)
* @param string $path the absolute path of this item
* @param Session the session instance
* @param ObjectManager the objectmanager instance - the caller has to take care of registering this item with the object manager
* @param boolean $new optional: set to true to make this property aware its not yet existing on the server. defaults to false
*/
public function __construct($factory, array $data, $path, Session $session, ObjectManager $objectManager, $new = false)
{
parent::__construct($factory, $path, $session, $objectManager, $new);
$type = $data['type'];
if (is_string($type)) {
$type = \PHPCR\PropertyType::valueFromName($type);
} elseif (!is_numeric($type)) {
throw new \PHPCR\RepositoryException("INTERNAL ERROR -- No valid type specified ({$type})");
} else {
//sanity check. this will throw InvalidArgumentException if $type is not a valid type
\PHPCR\PropertyType::nameFromValue($type);
}
$this->type = $type;
if (is_array($data['value'])) {
$this->isMultiple = true;
$this->value = array();
foreach ($data['value'] as $value) {
$this->value[] = Helper::convertType($value, $type);
}
} elseif (null !== $data['value']) {
$this->value = Helper::convertType($data['value'], $type);
} else {
throw new \PHPCR\RepositoryException('INTERNAL ERROR -- data[value] may not be null');
}
}
示例6: Server
public function Server($id = false, $style_sd = false)
{
global $bd_names;
parent::__construct($id, ItemType::Server, $bd_names['servers'], $style_sd);
if (!$this->id) {
return false;
}
$line = getDB()->fetchRow("SELECT * FROM `" . $this->db . "` WHERE id='{$this->id}'");
if (!$line) {
$this->id = false;
return false;
}
$this->address = $line['address'];
$this->port = (int) $line['port'];
$this->method = (int) $line['method'];
$this->name = $line['name'];
$this->slots = (int) $line['slots'];
$this->info = $line['info'];
$this->numpl = (int) $line['numpl'];
$this->online = $line['online'] ? true : false;
$this->refresh = (int) $line['refresh_time'];
$this->rcon = !strlen($line['rcon']) ? false : $line['rcon'];
$this->s_user = !strlen($line['service_user']) ? false : $line['service_user'];
return true;
}
示例7: __construct
public function __construct($variableName, $title, $value = null)
{
parent::__construct();
$this->variableName = $variableName;
$this->title = $title;
$this->value = $value;
}
示例8: __construct
public function __construct($slug, $nome, $peso, $preco, $rd, $areas, $dp = 0)
{
parent::__construct($slug, $nome, $peso, $preco);
$this->dp = $dp;
$this->rd = $rd;
$this->areas = $areas;
}
示例9: __construct
public function __construct($path)
{
global $globals;
parent::__construct($path);
//if (empty($this->text))
// $this->text = $globals->info->home;
}
示例10: __construct
public function __construct($key, $type, $relatedClass, $foreignKey, $value = null)
{
parent::__construct($key, $value);
$this->type = $type;
$this->relatedClass = $relatedClass;
$this->foreignKey = $foreignKey;
}
示例11: __construct
public function __construct($id = false, $style_sd = false)
{
global $bd_names, $site_ways, $config;
parent::__construct($id, ItemType::Skin, $bd_names['sp_skins'], $style_sd);
$this->base_dir = MCR_ROOT . 'instruments/sp2/skins/';
$this->base_url = 'instruments/sp2/skins/';
$this->base_name = 'sp_nc';
$this->db_likes = $bd_names['likes'];
$this->db_bad_skins = $bd_names['sp_bad_skins'];
$this->db_ratio = $bd_names['sp_skins_ratio'];
if (!$this->id) {
return false;
}
$result = BD("SELECT `name`, `fname`, `fsize`, `dislikes`, `likes`, `ratio`, `gender`, `downloads`, `comments`, `user_id`, `comment_last` FROM `{$this->db}` WHERE `id`='" . $this->id . "'");
if (mysql_num_rows($result) != 1) {
$this->id = false;
return false;
}
$line = mysql_fetch_array($result, MYSQL_NUM);
$this->name = $line[0];
$this->fname = $line[1];
$this->fsize = $line[2];
$this->dislikes = (int) $line[3];
$this->likes = (int) $line[4];
$this->ratio = (int) $line[5];
$this->gender = (int) $line[6];
$this->downloads = (int) $line[7];
$this->comments = (int) $line[8];
$this->user_id = (int) $line[9];
$this->comment_last = $line[10] === '0000-00-00 00:00:00' ? false : $line[10];
}
示例12: __construct
public function __construct($meta = 0, $count = 1)
{
parent::__construct(self::COOKED_FISH, $meta, $count, "Cooked Fish");
if ($this->meta === 1) {
$this->name = "Cooked Salmon";
}
}
示例13: __construct
public function __construct($title, $subtitle, $longitude, $latitude)
{
parent::__construct();
$this->title = $title;
$this->subtitle = $subtitle;
$this->setPosition($longitude, $latitude);
}
示例14: __construct
public function __construct($html = null)
{
parent::__construct();
if ($html) {
$this->html($html);
}
return $this;
}
示例15: __construct
public function __construct(\Closure $callback = null)
{
parent::__construct();
if (is_callable($callback)) {
call_user_func($callback, $this);
}
return $this;
}