當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Author::Load方法代碼示例

本文整理匯總了PHP中Author::Load方法的典型用法代碼示例。如果您正苦於以下問題:PHP Author::Load方法的具體用法?PHP Author::Load怎麽用?PHP Author::Load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Author的用法示例。


在下文中一共展示了Author::Load方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testIssetWithOverloading

 public function testIssetWithOverloading()
 {
     include_once "php/mt.php";
     include_once "php/lib/MTUtil.php";
     $cfg_file = realpath("t/mysql-test.cfg");
     $mt = MT::get_instance(1, $cfg_file);
     $ctx =& $mt->context();
     // Test some objects inheriting ObjectBase class.
     require_once "php/lib/class.mt_config.php";
     $config = new Config();
     $config->Load();
     $this->assertTrue(isset($config->id));
     require_once "php/lib/class.mt_author.php";
     $author = new Author();
     $author->Load();
     $this->assertTrue(isset($author->id));
     // protected variable call (bugid:113105)
     require_once "php/lib/class.mt_entry.php";
     $entry = new Entry();
     $entry->id = 1;
     $this->assertTrue(isset($entry->id));
     $this->assertNull($entry->_prefix);
     $this->assertFalse(isset($entry->_prefix));
     // fixed Dynamic publishing error occurred with memcached environment. bugid: 113546
     $mt->config('MemcachedServers', '127.0.0.1:11211');
     $obj_names = array('asset' => 'Asset', 'author' => 'Author', 'blog' => 'Blog', 'category' => 'Category', 'comment' => 'Comment', 'entry' => 'Entry', 'folder' => 'Folder', 'page' => 'Page', 'tbping' => 'TBPing', 'template' => 'Template', 'website' => 'Website');
     foreach ($obj_names as $table => $name) {
         require_once "php/lib/class.mt_{$table}.php";
         $obj = new $name();
         $obj->Load();
         $this->cache("{$table}:" . $obj->id, $obj);
         $obj_cache = $this->load_cache("{$table}:" . $obj->id);
         $this->assertInstanceOf("{$name}", $obj_cache);
     }
 }
開發者ID:benvanstaveren,項目名稱:movabletype,代碼行數:35,代碼來源:BaseObjectTest.php

示例2: commenter

 public function commenter()
 {
     $commenter_id = $this->comment_commenter_id;
     if (empty($commenter_id) || !is_numeric($commenter_id)) {
         return;
     }
     require_once 'class.mt_author.php';
     $author = new Author();
     if ($author->Load("author_id = {$commenter_id}")) {
         return $author;
     }
     return null;
 }
開發者ID:OCMO,項目名稱:movabletype,代碼行數:13,代碼來源:class.mt_comment.php

示例3: smarty_function_mtassetaddedby

function smarty_function_mtassetaddedby($args, &$ctx)
{
    $asset = $ctx->stash('asset');
    if (!$asset) {
        return '';
    }
    require_once 'class.mt_author.php';
    $author = new Author();
    $author->Load("author_id = " . $asset->created_by);
    if ($author->nickname != '') {
        return $author->nickname;
    }
    return $author->name;
}
開發者ID:OCMO,項目名稱:movabletype,代碼行數:14,代碼來源:function.mtassetaddedby.php

示例4: testIssetWithOverloading

 public function testIssetWithOverloading()
 {
     include_once "php/mt.php";
     include_once "php/lib/MTUtil.php";
     $cfg_file = realpath("t/mysql-test.cfg");
     $mt = MT::get_instance(1, $cfg_file);
     $ctx =& $mt->context();
     // Test some objects inheriting ObjectBase class.
     require_once "php/lib/class.mt_config.php";
     $config = new Config();
     $config->Load();
     $this->assertTrue(isset($config->id));
     require_once "php/lib/class.mt_author.php";
     $author = new Author();
     $author->Load();
     $this->assertTrue(isset($author->id));
     // protected variable call (bugid:113105)
     require_once "php/lib/class.mt_entry.php";
     $entry = new Entry();
     $entry->Load();
     $this->assertTrue(isset($entry->id));
     $this->assertNull($entry->_prefix);
     $this->assertFalse(isset($entry->_prefix));
 }
開發者ID:nanosyan,項目名稱:movabletype,代碼行數:24,代碼來源:BaseObjectTest.php

示例5: author

 public function author()
 {
     $col_name = $this->_prefix . "author_id";
     $author = null;
     if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
         $author_id = $this->{$col_name};
         $author = $this->load_cache($this->_prefix . ":" . $this->id . ":author:" . $author_id);
         if (empty($author)) {
             require_once 'class.mt_author.php';
             $author = new Author();
             $author->Load("author_id = {$author_id}");
             $this->cache($this->_prefix . ":" . $this->id . ":author:" . $author->id, $author);
         }
     }
     return $author;
 }
開發者ID:benvanstaveren,項目名稱:movabletype,代碼行數:16,代碼來源:class.baseobject.php


注:本文中的Author::Load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。