本文整理汇总了PHP中Sprig::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP Sprig::__get方法的具体用法?PHP Sprig::__get怎么用?PHP Sprig::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprig
的用法示例。
在下文中一共展示了Sprig::__get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Overload Sprig::__get() to return
*
* - email md5 hash for gravatar
*/
public function __get($name)
{
if ($name == 'gravatar') {
$email = md5(strtolower(trim($this->email)));
return $email;
} else {
return parent::__get($name);
}
}
示例2: __get
/**
* Overload Sprig::__get() to return comments array
*
* @param string variable name
* @return mixed
*/
public function __get($key)
{
if ($key == 'comments') {
return empty($this->comment) ? array() : unserialize($this->comment);
} elseif ($key == 'diff') {
return empty($this->_original['diff']) ? '' : unserialize($this->_original['diff']);
} else {
return parent::__get($key);
}
}
示例3: __get
/**
* Overload Sprig::__get() to get
* full path
*/
public function __get($name) {
if ($name == 'path')
{
return Kohana::config('blog.upload.folder').'/'.$this->filename;
}
else
{
return parent::__get($name);
}
}
示例4: __get
public function __get($field)
{
if ($field === 'post_excerpt') {
if (!parent::__get('post_excerpt')) {
return Text::limit_words(parent::__get('post_content'), 50, ' ...');
}
}
if ($field === 'link') {
return Route::get('public/blog')->uri(array('slug' => $this->slug));
}
return parent::__get($field);
}
示例5: __get
/**
* Overload Sprig::__get() to unserialize the data array
*/
public function __get($name)
{
if ($name == 'data') {
if (empty($this->_original['data'])) {
return array_fill(0, $this->_length, 0);
} else {
return explode(",", $this->_original['data']);
}
} else {
return parent::__get($name);
}
}
示例6: __get
/**
*
* @access public
* @param $column - Which field to get.
* @return mixed
*/
public function __get($column)
{
switch ($column) {
case 'parent':
return $this->parent();
case 'parents':
return $this->parents();
case 'children':
return $this->children();
case 'first_child':
return $this->children(FALSE, 'ASC', 1);
case 'last_child':
return $this->children(FALSE, 'DESC', 1);
case 'siblings':
return $this->siblings();
case 'root':
return $this->root();
case 'leaves':
return $this->leaves();
case 'descendants':
return $this->descendants();
default:
return parent::__get($column);
}
}
示例7: __get
/**
*
* @access public
* @param $column - Which field to get.
* @return mixed
*/
public function __get($name)
{
if (!$this->_init) {
// The constructor must always be called first
$this->__construct();
// This object is about to be loaded by mysql_fetch_object() or similar
$this->state('loading');
}
if (isset($this->_related[$name])) {
// Shortcut to any related object
return $this->_related[$name];
}
switch ($name) {
case 'parent':
$this->parent($query);
$limit = 1;
break;
case 'ancestors':
$this->ancestors($query);
$limit = FALSE;
break;
case 'children':
$this->children($query);
$limit = FALSE;
break;
case 'first_child':
$this->children($query, FALSE, 'ASC');
$limit = 1;
break;
case 'last_child':
$this->children($query, FALSE, 'DESC');
$limit = 1;
break;
case 'siblings':
$this->siblings($query);
$limit = FALSE;
break;
case 'root':
$this->root($query);
$limit = 1;
break;
case 'leaves':
$this->leaves($query);
$limit = FALSE;
break;
case 'descendants':
$this->descendants($query);
$limit = FALSE;
break;
default:
return parent::__get($name);
}
return $this->_related[$name] = Sprig::factory($this->_model)->load($query, $limit);
}