Esempio n. 1
0
 public function fetch_website($blog_id)
 {
     if (!empty($this->_blog_id_cache) && isset($this->_blog_id_cache[$blog_id])) {
         return $this->_blog_id_cache[$blog_id];
     }
     require_once 'class.mt_website.php';
     $blog = new Website();
     $blog->Load("blog_id = {$blog_id}");
     $this->_blog_id_cache[$blog_id] = $blog;
     return $blog;
 }
 public function blog()
 {
     $col_name = $this->_prefix . "blog_id";
     $blog = null;
     if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
         $blog_id = $this->{$col_name};
         $blog = $this->load_cache($this->_prefix . ":" . $this->id . ":blog:" . $blog_id);
         if (empty($blog)) {
             require_once 'class.mt_blog.php';
             $blog = new Blog();
             $blog->Load("blog_id = {$blog_id}");
         }
     }
     if ($blog->class == 'website') {
         require_once 'class.mt_website.php';
         $blog = new Website();
         $blog->Load("blog_id = {$blog_id}");
     }
     if (!empty($blog)) {
         $this->cache($this->_prefix . ":" . $this->id . ":blog:" . $blog->id, $blog);
     }
     return $blog;
 }