当前位置: 首页>>代码示例>>PHP>>正文


PHP Sprig::__get方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:vimofthevine,项目名称:kohana-blog,代码行数:14,代码来源:comment.php

示例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);
     }
 }
开发者ID:vimofthevine,项目名称:versioned,代码行数:16,代码来源:revision.php

示例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);
		}
	} 
开发者ID:nagius,项目名称:kohana-blog,代码行数:14,代码来源:photo.php

示例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);
 }
开发者ID:kerkness,项目名称:shindig,代码行数:12,代码来源:post.php

示例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);
     }
 }
开发者ID:vimofthevine,项目名称:kohana-blog,代码行数:15,代码来源:statistic.php

示例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);
     }
 }
开发者ID:banks,项目名称:sprig-mptt,代码行数:31,代码来源:mptt.php

示例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);
 }
开发者ID:ascseb,项目名称:sprig-mptt,代码行数:60,代码来源:mptt.php


注:本文中的Sprig::__get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。