Esempio n. 1
0
 public function __get($key)
 {
     switch ($key) {
         case 'id':
         case 'author_id':
         case 'title':
         case 'content':
         case 'summary':
         case 'extra':
         case 'news_url':
         case 'postdate':
             // db time format
         // db time format
         case 'startdate':
             // db time format
         // db time format
         case 'enddate':
             // db time format
         // db time format
         case 'create_date':
             // db time format
         // db time format
         case 'modified_date':
             // db time format
         // db time format
         case 'category_id':
         case 'status':
             return $this->_getdata($key);
         case 'file_location':
             $config = cmsms()->GetConfig();
             $url = $config['uploads_url'] . '/news/id' . $this->id;
             return $url;
         case 'author':
             // metadata.
             return $this->_getauthorinfo($this->author_id);
         case 'authorname':
             // metadata.
             return $this->_getauthorinfo($this->author_id, TRUE);
         case 'category':
             // metadata.
             return news_ops::get_category_name_from_id($this->category_id);
         case 'useexp':
             if (isset($this->_meta['useexp'])) {
                 return $this->_meta['useexp'];
             }
             return 0;
         case 'canonical':
             // metadata
             return $this->_get_canonical();
             break;
         case 'fields':
         case 'customfieldsbyname':
             // deprecated
         // deprecated
         case 'fieldsbyname':
             // deprecated
             if (isset($this->_rawdata['fieldsbyname'])) {
                 return $this->_rawdata['fieldsbyname'];
             }
             break;
             //       case 'printlink':    // meta
             // 	// metadata
             // 	return $this->_get_printurl(true);
             //       case 'printurl':    // meta
             // 	// metadata
             // 	return $this->_get_printurl();
         //       case 'printlink':    // meta
         // 	// metadata
         // 	return $this->_get_printurl(true);
         //       case 'printurl':    // meta
         // 	// metadata
         // 	return $this->_get_printurl();
         case 'returnid':
             // metadata
             return $this->_get_returnid();
         case 'params':
             // metadata
             return $this->_get_params();
         default:
             // check if there is a field with this alias
             if (isset($this->_rawdata['fieldsbyname']) && is_array($this->_rawdata['fieldsbyname'])) {
                 foreach ($this->_rawdata['fieldsbyname'] as $fname => &$obj) {
                     if (!is_object($obj)) {
                         continue;
                     }
                     if ($key == $obj->alias) {
                         return $obj->value;
                     }
                 }
             }
             //throw new Exception('Requesting indvlid data from News article object '.$key);
     }
 }