Ejemplo n.º 1
0
 public function __get($name)
 {
     // if there is a _ in the name, there is a filter at the end
     if (strpos($name, '_') !== false) {
         // pick off the last _'d piece
         preg_match('/^(.*)_([^_]+)$/', $name, $matches);
         list($junk, $name, $filter) = $matches;
         // so that we don't break every info value that has a _ in it, only _out is an acceptable filter name
         if ($filter != 'out') {
             // put it back together
             $name = $name . '_' . $filter;
             // turn off the filter
             $filter = false;
         }
     } else {
         $filter = false;
     }
     // get the value by calling our parent function directly
     $value = parent::__get($name);
     // apply the main filter so values can be altered regardless of any _filter
     $value = Plugins::filter("post_info_{$name}", $value);
     // if there is a filter, apply that specific one too
     if ($filter) {
         $value = Plugins::filter("post_info_{$name}_{$filter}", $value);
     }
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * function get_info
  * Gets the info object for this post, which contains data from the postinfo table
  * related to this post.
  * @return PostInfo object
  */
 private function get_info()
 {
     if (!isset($this->inforecords)) {
         // If this post isn't in the database yet...
         if (0 == $this->id) {
             $this->inforecords = new PostInfo();
         } else {
             $this->inforecords = new PostInfo($this->id);
         }
     } else {
         $this->inforecords->set_key($this->id);
     }
     return $this->inforecords;
 }
Ejemplo n.º 3
0
 function __construct($post_id)
 {
     parent::__construct(DB::table('postinfo'), "post_id", $post_id);
     // call parent with appropriate  parameters
 }
Ejemplo n.º 4
0
 function __construct($user_id = null)
 {
     // call parent with appropriate  parameters
     parent::__construct(DB::table('userinfo'), 'user_id', $user_id);
 }
Ejemplo n.º 5
0
 function __construct($comment_id = NULL)
 {
     parent::__construct(DB::table('commentinfo'), 'comment_id', $comment_id);
     // call parent with appropriate  parameters
 }
Ejemplo n.º 6
0
 function __construct($term_id = null)
 {
     parent::__construct(DB::table('terminfo'), 'term_id', $term_id);
     // call parent with appropriate  parameters
 }