__get() public method

Alias for offsetget()
public __get ( $key ) : mixed
$key string
return mixed
Exemplo n.º 1
0
 /**
  * 获取参数值
  * @param $name
  * @return bool|mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'SourceType') {
         if ($this->Source == 'system') {
             return 'system';
         } elseif ($this->Source == 'user') {
             return 'user';
         } elseif ($this->Source == 'theme') {
             return 'theme';
         } elseif ($this->Source == 'plugin_' . $zbp->theme) {
             return 'theme';
         } else {
             return 'plugin';
         }
     }
     if ($name == 'NoRefresh') {
         return (bool) $this->Metas->norefresh;
     }
     if ($name == 'Name' && $this->Source == 'system') {
         switch ($this->FileName) {
             case 'calendar':
                 return $zbp->lang['msg']['calendar'];
             case 'controlpanel':
                 return $zbp->lang['msg']['control_panel'];
             case 'searchpanel':
                 return $zbp->lang['msg']['search'];
             default:
                 return $zbp->lang['msg']['module_' . $this->FileName];
         }
     }
     return parent::__get($name);
 }
Exemplo n.º 2
0
 /**
  * @param $name
  * @return mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         foreach ($GLOBALS['hooks']['Filter_Plugin_Tag_Url'] as $fpname => &$fpsignal) {
             $fpsignal = PLUGIN_EXITSIGNAL_NONE;
             $fpreturn = $fpname($this);
             if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
                 return $fpreturn;
             }
         }
         $backAttr = $zbp->option['ZC_ALIAS_BACK_ATTR'];
         $u = new UrlRule($zbp->option['ZC_TAGS_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = rawurlencode($this->Alias == '' ? $this->{$backAttr} : $this->Alias);
         return $u->Make();
     }
     if ($name == 'Template') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     return parent::__get($name);
 }
Exemplo n.º 3
0
 /**
  * 获取参数值
  * @param $name
  * @return bool|mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'SourceType') {
         if ($this->Source == 'system') {
             return 'system';
         } elseif ($this->Source == 'user') {
             return 'user';
         } elseif ($this->Source == 'theme') {
             return 'theme';
         } elseif ($this->Source == 'plugin_' . $zbp->theme) {
             return 'theme';
         } else {
             return 'plugin';
         }
     }
     if ($name == 'NoRefresh') {
         $n = 'module_norefresh_' . $this->FileName;
         if ($zbp->cache->HasKey($n) == true) {
             return true;
         } else {
             return false;
         }
     }
     return parent::__get($name);
 }
Exemplo n.º 4
0
 function __get($property)
 {
     if ($property == 'PostCount') {
         if (is_null($this->_PostCount)) {
             global $DB;
             $this->_PostCount = $DB->formdata->count(array('id' => $this->ID, 'field_id' => 'poster'), 'value');
         }
         return $this->_PostCount;
     } else {
         return parent::__get($property);
     }
 }
Exemplo n.º 5
0
 public function __get($sKey)
 {
     $mGet = parent::__get($sKey);
     if ($mGet !== null) {
         return $mGet;
     }
     if (isset($_SESSION['user'][$sKey])) {
         return $_SESSION['user'][$sKey];
     } else {
         return null;
     }
 }
Exemplo n.º 6
0
 public function __get($key)
 {
     if (substr($key, 0, 6) == 'scale_') {
         $factor = substr($key, 6);
         if (($split = strpos($factor, '_')) !== FALSE) {
             $x = substr($factor, 0, $split);
             $y = substr($factor, $split + 1);
         } else {
             $x = $factor;
             $y = 0;
         }
         return $this->scale($x, $y);
     }
     return parent::__get($key);
 }
Exemplo n.º 7
0
 public function __get($name)
 {
     global $zbp;
     if ($name == 'SourceType') {
         if ($this->Source == 'system') {
             return 'system';
         } elseif ($this->Source == 'user') {
             return 'user';
         } elseif ($this->Source == 'theme') {
             return 'theme';
         } else {
             return 'plugin';
         }
     }
     return parent::__get($name);
 }
Exemplo n.º 8
0
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         $u = new UrlRule($zbp->option['ZC_TAGS_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = $this->Alias == '' ? urlencode($this->Name) : $this->Alias;
         return $u->Make();
     }
     if ($name == 'Template') {
         $value = $this->Data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     return parent::__get($name);
 }
Exemplo n.º 9
0
 /**
  * 获取参数值
  * @param $name
  * @return bool|mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'SourceType') {
         if ($this->Source == 'system') {
             return 'system';
         } elseif ($this->Source == 'user') {
             return 'user';
         } elseif ($this->Source == 'theme') {
             return 'theme';
         } elseif ($this->Source == 'plugin_' . $zbp->theme) {
             return 'theme';
         } else {
             return 'plugin';
         }
     }
     if ($name == 'NoRefresh') {
         return (bool) $this->Metas->norefresh;
     }
     return parent::__get($name);
 }
Exemplo n.º 10
0
 /**
  * @param $name
  * @return mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         $u = new UrlRule($zbp->option['ZC_AUTHOR_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = $this->Alias == '' ? rawurlencode($this->Name) : $this->Alias;
         return $u->Make();
     }
     if ($name == 'Avatar') {
         foreach ($GLOBALS['hooks']['Filter_Plugin_Mebmer_Avatar'] as $fpname => &$fpsignal) {
             $fpreturn = $fpname($this);
             if ($fpreturn) {
                 $fpsignal = PLUGIN_EXITSIGNAL_NONE;
                 return $fpreturn;
             }
         }
         if ($this->_avatar) {
             return $this->_avatar;
         }
         $s = $zbp->usersdir . 'avatar/' . $this->ID . '.png';
         if (is_readable($s)) {
             $this->_avatar = $zbp->host . 'zb_users/avatar/' . $this->ID . '.png';
             return $this->_avatar;
         }
         $this->_avatar = $zbp->host . 'zb_users/avatar/0.png';
         return $this->_avatar;
     }
     if ($name == 'LevelName') {
         return $zbp->lang['user_level_name'][$this->Level];
     }
     if ($name == 'EmailMD5') {
         return md5($this->Email);
     }
     if ($name == 'StaticName') {
         if ($this->Alias) {
             return $this->Alias;
         }
         return $this->Name;
     }
     if ($name == 'Template') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     if ($name == 'PassWord_MD5Path') {
         return md5($this->Password . $zbp->guid);
     }
     if ($name == 'IsGod') {
         if ($this->_isgod === true || $this->_isgod === false) {
             return $this->_isgod;
         } else {
             $sql = $zbp->db->sql->Select($zbp->table['Member'], '*', array(array('=', 'mem_Level', 1)), 'mem_ID ASC', 1, null);
             $am = $zbp->GetListType('Member', $sql);
             if ($am[0]->ID == $this->ID) {
                 $this->_isgod = true;
             } else {
                 $this->_isgod = false;
             }
             return $this->_isgod;
         }
     }
     return parent::__get($name);
 }
Exemplo n.º 11
0
 /**
  * @param $name
  * @return int|mixed|null|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         foreach ($GLOBALS['hooks']['Filter_Plugin_Category_Url'] as $fpname => &$fpsignal) {
             $fpsignal = PLUGIN_EXITSIGNAL_NONE;
             $fpreturn = $fpname($this);
             if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
                 return $fpreturn;
             }
         }
         $backAttr = $zbp->option['ZC_ALIAS_BACK_ATTR'];
         $u = new UrlRule($zbp->option['ZC_CATEGORY_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = rawurlencode($this->Alias == '' ? $this->{$backAttr} : $this->Alias);
         return $u->Make();
     }
     if ($name == 'Symbol') {
         if ($this->ParentID == 0) {
             return;
         } else {
             $l = $this->Level;
             return str_repeat(' ', $l * 2 - 1) . '└';
         }
     }
     if ($name == 'Level') {
         return $this->GetDeep($this);
     }
     if ($name == 'SymbolName') {
         return $this->Symbol . htmlspecialchars($this->Name);
     }
     if ($name == 'Parent') {
         if ($this->ParentID == 0) {
             return null;
         } else {
             return $zbp->categorys[$this->ParentID];
         }
     }
     if ($name == 'Template') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     if ($name == 'LogTemplate') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_POST_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     return parent::__get($name);
 }
Exemplo n.º 12
0
 /**
  * Automatically generate some values if they are NULL
  **/
 function __get($var)
 {
     $value = parent::__get($var);
     if ($value === NULL) {
         switch ($var) {
             case 'caption':
                 $name = $this->name;
                 if ($name !== null) {
                     $value = ucwords($this->name);
                 }
                 break;
         }
     }
     return $value;
 }
Exemplo n.º 13
0
 public function __get($name)
 {
     global $zbp;
     switch ($name) {
         case 'Category':
             return $zbp->GetCategoryByID($this->CateID);
             break;
         case 'Author':
             return $zbp->GetMemberByID($this->AuthorID);
             break;
         case 'StatusName':
             return $zbp->lang['post_status_name'][$this->Status];
             break;
         case 'Url':
             if ($this->Type == ZC_POST_TYPE_ARTICLE) {
                 $u = new UrlRule($zbp->option['ZC_ARTICLE_REGEX']);
             } else {
                 $u = new UrlRule($zbp->option['ZC_PAGE_REGEX']);
             }
             $u->Rules['{%id%}'] = $this->ID;
             if ($this->Alias) {
                 $u->Rules['{%alias%}'] = $this->Alias;
             } else {
                 $u->Rules['{%alias%}'] = urlencode($this->Title);
             }
             $u->Rules['{%year%}'] = $this->Time('Y');
             $u->Rules['{%month%}'] = $this->Time('m');
             $u->Rules['{%day%}'] = $this->Time('d');
             if ($this->Category->Alias) {
                 $u->Rules['{%category%}'] = $this->Category->Alias;
             } else {
                 $u->Rules['{%category%}'] = urlencode($this->Category->Name);
             }
             if ($this->Author->Alias) {
                 $u->Rules['{%author%}'] = $this->Author->Alias;
             } else {
                 $u->Rules['{%author%}'] = urlencode($this->Author->Name);
             }
             return $u->Make();
             break;
         case 'Tags':
             return $zbp->LoadTagsByIDString($this->Tag);
             break;
         case 'TagsCount':
             return substr_count($this->Tag, '{');
             break;
         case 'TagsName':
             return $this->TagsToNameString;
         case 'Template':
             $value = $this->Data[$name];
             if ($value == '') {
                 $value = GetValueInArray($this->Category->GetDataArray(), 'LogTemplate');
                 if ($value == '') {
                     $value = $zbp->option['ZC_POST_DEFAULT_TEMPLATE'];
                 }
             }
             return $value;
         case 'CommentPostUrl':
             foreach ($GLOBALS['Filter_Plugin_Post_CommentPostUrl'] as $fpname => &$fpsignal) {
                 $fpreturn = $fpname($this);
                 if ($fpreturn) {
                     return $fpreturn;
                 }
             }
             $key = '&key=' . md5($zbp->guid . $this->ID . date('Y-m-d'));
             return $zbp->host . 'zb_system/cmd.php?act=cmt&postid=' . $this->ID . $key;
             break;
         case 'ValidCodeUrl':
             return $zbp->validcodeurl . '?id=cmt';
             break;
         case 'Prev':
             static $_prev = null;
             if ($_prev !== null) {
                 return $_prev;
             }
             $articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('<', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'DESC'), array(1), null);
             if (count($articles) == 1) {
                 $_prev = $articles[0];
             } else {
                 $_prev = '';
             }
             return $_prev;
             break;
         case 'Next':
             static $_next = null;
             if ($_next !== null) {
                 return $_next;
             }
             $articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('>', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'ASC'), array(1), null);
             if (count($articles) == 1) {
                 $_next = $articles[0];
             } else {
                 $_next = '';
             }
             return $_next;
             break;
         default:
             return parent::__get($name);
             break;
     }
 }
Exemplo n.º 14
0
 /**
  * @param $name
  * @return int|mixed|null|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         $u = new UrlRule($zbp->option['ZC_CATEGORY_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = $this->Alias == '' ? urlencode($this->Name) : $this->Alias;
         return $u->Make();
     }
     if ($name == 'Symbol') {
         if ($this->ParentID == 0) {
             return;
         } else {
             $l = $this->Level;
             if ($l == 1) {
                 return '&nbsp;└';
             } elseif ($l == 2) {
                 return '&nbsp;&nbsp;&nbsp;└';
             } elseif ($l == 3) {
                 return '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└';
             }
             return;
         }
     }
     if ($name == 'Level') {
         if ($this->ParentID == 0) {
             $this->RootID = 0;
             return 0;
         }
         if ($zbp->categorys[$this->ParentID]->ParentID == 0) {
             $this->RootID = $this->ParentID;
             return 1;
         }
         if ($zbp->categorys[$zbp->categorys[$this->ParentID]->ParentID]->ParentID == 0) {
             $this->RootID = $zbp->categorys[$this->ParentID]->ParentID;
             return 2;
         }
         if ($zbp->categorys[$zbp->categorys[$zbp->categorys[$this->ParentID]->ParentID]->ParentID]->ParentID == 0) {
             $this->RootID = $zbp->categorys[$zbp->categorys[$this->ParentID]->ParentID]->ParentID;
             return 3;
         }
         return 0;
     }
     if ($name == 'SymbolName') {
         return $this->Symbol . htmlspecialchars($this->Name);
     }
     if ($name == 'Parent') {
         if ($this->ParentID == 0) {
             return null;
         } else {
             return $zbp->categorys[$this->ParentID];
         }
     }
     if ($name == 'Template') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     if ($name == 'LogTemplate') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_POST_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     return parent::__get($name);
 }
Exemplo n.º 15
0
 function __get($property)
 {
     if (in_array($property, array('module', 'page', 'type', 'size', 'row', 'place', 'content'))) {
         $ipn = '_' . $property;
         if ($this->{$ipn} === false) {
             $this->ld();
         }
         return $this->{$ipn};
     } elseif ($property == 'settings') {
         if ($this->_settings === false) {
             $this->ld();
         }
         return $this->_settings;
     } else {
         return parent::__get($property);
     }
 }
Exemplo n.º 16
0
 /**
  * Returns the data of a given property. Unrecognized properties are forwarded to it's parent.
  * @see solidbase/lib/Base#__get($property)
  */
 function __get($property)
 {
     switch ($property) {
         case 'language':
             return $this->language();
         case 'parentID':
             return @self::$PARENTS[$this->ID];
         case 'parentIDs':
             return $this->parents(false);
         case 'parent':
             if (isset(self::$PARENTS[$this->ID]) && self::$PARENTS[$this->ID]) {
                 global $Controller;
                 return $Controller->{(string) self::$PARENTS[$this->ID]}(OVERRIDE);
             } else {
                 return false;
             }
         case 'parents':
             return $this->parents();
         case 'place':
             if (isset(self::$PLACES[$this->ID])) {
                 return self::$PLACES[$this->ID];
             } else {
                 return false;
             }
         case 'link':
             return $this->{'_' . $property};
         case 'children':
         case 'next':
         case 'previous':
             return $this->{$property}();
             break;
         default:
             return parent::__get($property);
     }
 }
Exemplo n.º 17
0
 public function &__get($var)
 {
     if (array_key_exists($var, $this->sqlExpressions)) {
         return $this->sqlExpressions[$var];
     } else {
         if (array_key_exists($var, $this->relations)) {
             return $this->getRelation($var);
         } else {
             return parent::__get($var);
         }
     }
 }
Exemplo n.º 18
0
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Author') {
         $m = $zbp->GetMemberByID($this->AuthorID);
         if ($m->ID == 0) {
             $m->Name = $this->Name;
             $m->Email = $this->Email;
             $m->HomePage = $this->HomePage;
         }
         return $m;
     }
     if ($name == 'Comments') {
         $array = array();
         foreach ($zbp->comments as $comment) {
             if ($comment->ParentID == $this->ID) {
                 $array[] =& $zbp->comments[$comment->ID];
             }
         }
         return $array;
     }
     if ($name == 'Level') {
         if ($this->ParentID == 0) {
             return 0;
         }
         $c1 = $zbp->GetCommentByID($this->ParentID);
         if ($c1->ParentID == 0) {
             return 1;
         }
         $c2 = $zbp->GetCommentByID($c1->ParentID);
         if ($c2->ParentID == 0) {
             return 2;
         }
         $c3 = $zbp->GetCommentByID($c2->ParentID);
         if ($c3->ParentID == 0) {
             return 3;
         }
         return 4;
     }
     if ($name == 'Post') {
         $p = $zbp->GetPostByID($this->LogID);
         return $p;
     }
     return parent::__get($name);
 }
Exemplo n.º 19
0
 /**
  * @param $name
  * @return Member|mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         foreach ($GLOBALS['hooks']['Filter_Plugin_Upload_Url'] as $fpname => &$fpsignal) {
             return $fpname($this);
         }
         return $zbp->host . 'zb_users/' . $this->Dir . rawurlencode($this->Name);
     }
     if ($name == 'Dir') {
         foreach ($GLOBALS['hooks']['Filter_Plugin_Upload_Dir'] as $fpname => &$fpsignal) {
             return $fpname($this);
         }
         return 'upload/' . date('Y', $this->PostTime) . '/' . date('m', $this->PostTime) . '/';
     }
     if ($name == 'FullFile') {
         return $zbp->usersdir . $this->Dir . $this->Name;
     }
     if ($name == 'Author') {
         return $zbp->GetMemberByID($this->AuthorID);
     }
     return parent::__get($name);
 }
Exemplo n.º 20
0
 function __get($prop)
 {
     // if ($value = parent::__get($prop)) return $value;
     // lazy load relations
     if (isset(static::$hasOne[$prop]) && !isset($this->{$prop})) {
         $this->hasOne($prop);
     }
     isset(static::$richJoin[$prop]) ? $extraCols = (array) static::$richJoin[$prop] : ($extraCols = []);
     if (isset(static::$manyToMany[$prop]) && !isset($this->{$prop})) {
         $this->manyToMany($prop, $extraCols);
     }
     if (isset(static::$hasMany[$prop]) && !isset($this->{$prop})) {
         $this->hasMany($prop);
     }
     return parent::__get($prop);
 }
Exemplo n.º 21
0
 /**
  * @param $name
  * @return array|int|mixed|null|string
  */
 public function __get($name)
 {
     global $zbp;
     switch ($name) {
         case 'Category':
             return $zbp->GetCategoryByID($this->CateID);
             break;
         case 'Author':
             return $zbp->GetMemberByID($this->AuthorID);
             break;
         case 'StatusName':
             return $zbp->lang['post_status_name'][$this->Status];
             break;
         case 'Url':
             foreach ($GLOBALS['hooks']['Filter_Plugin_Post_Url'] as $fpname => &$fpsignal) {
                 $fpsignal = PLUGIN_EXITSIGNAL_NONE;
                 $fpreturn = $fpname($this);
                 if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
                     return $fpreturn;
                 }
             }
             $u = new UrlRule($zbp->GetPostType_UrlRule($this->Type));
             $u->Rules['{%id%}'] = $this->ID;
             if ($this->Alias) {
                 $u->Rules['{%alias%}'] = $this->Alias;
             } else {
                 if ($zbp->option['ZC_POST_ALIAS_USE_ID_NOT_TITLE'] == false) {
                     $u->Rules['{%alias%}'] = rawurlencode($this->Title);
                 } else {
                     $u->Rules['{%alias%}'] = $this->ID;
                 }
             }
             $u->Rules['{%year%}'] = $this->Time('Y');
             $u->Rules['{%month%}'] = $this->Time('m');
             $u->Rules['{%day%}'] = $this->Time('d');
             if ($this->Category->Alias) {
                 $u->Rules['{%category%}'] = $this->Category->Alias;
             } else {
                 $u->Rules['{%category%}'] = rawurlencode($this->Category->Name);
             }
             if ($this->Author->Alias) {
                 $u->Rules['{%author%}'] = $this->Author->Alias;
             } else {
                 $u->Rules['{%author%}'] = rawurlencode($this->Author->Name);
             }
             return $u->Make();
             break;
         case 'Tags':
             return $zbp->LoadTagsByIDString($this->Tag);
             break;
         case 'TagsCount':
             return substr_count($this->Tag, '{');
             break;
         case 'TagsName':
             return $this->TagsToNameString();
         case 'Template':
             $value = $this->data[$name];
             if ($value == '') {
                 $value = GetValueInArray($this->Category->GetData(), 'LogTemplate');
                 if ($value == '') {
                     $value = $zbp->GetPostType_Template($this->Type);
                 }
             }
             return $value;
         case 'CommentPostUrl':
             foreach ($GLOBALS['hooks']['Filter_Plugin_Post_CommentPostUrl'] as $fpname => &$fpsignal) {
                 $fpreturn = $fpname($this);
                 if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
                     $fpsignal = PLUGIN_EXITSIGNAL_NONE;
                     return $fpreturn;
                 }
             }
             $key = '&amp;key=' . $zbp->GetCmtKey($this->ID);
             return $zbp->host . 'zb_system/cmd.php?act=cmt&amp;postid=' . $this->ID . $key;
             break;
         case 'ValidCodeUrl':
             return $zbp->validcodeurl . '?id=cmt';
             break;
         case 'Prev':
             if ($this->_prev !== '') {
                 return $this->_prev;
             }
             foreach ($GLOBALS['hooks']['Filter_Plugin_Post_Prev'] as $fpname => &$fpsignal) {
                 $this->_prev = $fpname($this);
                 if ($this->_prev !== '') {
                     return $this->_prev;
                 }
             }
             $articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('<', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'DESC'), array(1), null);
             if (count($articles) == 1) {
                 $this->_prev = $articles[0];
             } else {
                 $this->_prev = null;
             }
             return $this->_prev;
             break;
         case 'Next':
             if ($this->_next !== '') {
                 return $this->_next;
             }
             foreach ($GLOBALS['hooks']['Filter_Plugin_Post_Next'] as $fpname => &$fpsignal) {
                 $this->_prev = $fpname($this);
                 if ($this->_prev !== '') {
                     return $this->_prev;
                 }
             }
             $articles = $zbp->GetPostList(array('*'), array(array('=', 'log_Type', 0), array('=', 'log_Status', 0), array('>', 'log_PostTime', $this->PostTime)), array('log_PostTime' => 'ASC'), array(1), null);
             if (count($articles) == 1) {
                 $this->_next = $articles[0];
             } else {
                 $this->_next = null;
             }
             return $this->_next;
             break;
         case 'RelatedList':
             foreach ($GLOBALS['hooks']['Filter_Plugin_Post_RelatedList'] as $fpname => &$fpsignal) {
                 $fpreturn = $fpname($this);
                 if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) {
                     $fpsignal = PLUGIN_EXITSIGNAL_NONE;
                     return $fpreturn;
                 }
             }
             return GetList($zbp->option['ZC_RELATEDLIST_COUNT'], null, null, null, null, null, array('is_related' => $this->ID));
         case 'TopType':
             $toptype = $this->Metas->toptype;
             if ($this->IsTop == true && $toptype == null) {
                 $toptype = 'index';
             }
             return $toptype;
         case 'TypeName':
             return $zbp->GetPostType_Name($this->Type);
         default:
             return parent::__get($name);
             break;
     }
 }
Exemplo n.º 22
0
 /**
  * @param $name
  * @return mixed|string
  */
 public function __get($name)
 {
     global $zbp;
     if ($name == 'Url') {
         $u = new UrlRule($zbp->option['ZC_AUTHOR_REGEX']);
         $u->Rules['{%id%}'] = $this->ID;
         $u->Rules['{%alias%}'] = $this->Alias == '' ? urlencode($this->Name) : $this->Alias;
         return $u->Make();
     }
     if ($name == 'Avatar') {
         foreach ($GLOBALS['Filter_Plugin_Mebmer_Avatar'] as $fpname => &$fpsignal) {
             $fpreturn = $fpname($this);
             if ($fpreturn) {
                 $fpsignal = PLUGIN_EXITSIGNAL_NONE;
                 return $fpreturn;
             }
         }
         if ($this->_avatar) {
             return $this->_avatar;
         }
         $s = $zbp->usersdir . 'avatar/' . $this->ID . '.png';
         if (is_readable($s)) {
             $this->_avatar = $zbp->host . 'zb_users/avatar/' . $this->ID . '.png';
             return $this->_avatar;
         }
         $this->_avatar = $zbp->host . 'zb_users/avatar/0.png';
         return $this->_avatar;
     }
     if ($name == 'LevelName') {
         return $zbp->lang['user_level_name'][$this->Level];
     }
     if ($name == 'EmailMD5') {
         return md5($this->Email);
     }
     if ($name == 'StaticName') {
         if ($this->Alias) {
             return $this->Alias;
         }
         return $this->Name;
     }
     if ($name == 'Template') {
         $value = $this->data[$name];
         if ($value == '') {
             $value = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE'];
         }
         return $value;
     }
     return parent::__get($name);
 }