本文整理汇总了PHP中Blog::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::Load方法的具体用法?PHP Blog::Load怎么用?PHP Blog::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::Load方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_mtblogarchiveurl
function smarty_function_mtblogarchiveurl($args, &$ctx)
{
if (isset($args['id']) && is_numeric($args['id'])) {
require_once 'class.mt_blog.php';
$blog = new Blog();
$ret = $blog->Load('blog_id = ' . $args['id']);
if (!$ret) {
$blog = null;
}
}
if (empty($blog)) {
$blog = $ctx->stash('blog');
}
if (empty($blog)) {
return '';
}
$url = $blog->archive_url();
if ($url == '') {
$url = $blog->site_url();
}
if (!preg_match('/\\/$/', $url)) {
$url .= '/';
}
return $url;
}
示例2: smarty_function_mtwebsiterelativeurl
function smarty_function_mtwebsiterelativeurl($args, &$ctx)
{
// status: complete
// parameters: none
if (isset($args['id']) && is_numeric($args['id'])) {
require_once 'class.mt_website.php';
$website = new Blog();
$ret = $website->Load('blog_id = ' . $args['id']);
if (!$ret) {
$website = null;
}
} else {
$blog = $ctx->stash('blog');
if (empty($blog)) {
return '';
}
$website = $blog->is_blog() ? $blog->website() : $blog;
}
if (empty($website)) {
return '';
}
$host = $website->site_url();
if (!preg_match('!/$!', $host)) {
$host .= '/';
}
if (preg_match('!^https?://[^/]+(/.*)$!', $host, $matches)) {
return $matches[1];
} else {
return '';
}
}
示例3: smarty_function_mtwebsitepath
function smarty_function_mtwebsitepath($args, &$ctx)
{
if (isset($args['id']) && is_numeric($args['id'])) {
require_once 'class.mt_website.php';
$blog = new Blog();
$ret = $blog->Load('blog_id = ' . $args['id']);
if (!$ret) {
$blog = null;
}
}
if (empty($blog)) {
$blog = $ctx->stash('blog');
}
if (empty($blog)) {
return '';
}
$website = $blog->is_blog() ? $blog->website() : $blog;
if (empty($website)) {
return '';
}
$path = $website->site_path();
if (!preg_match('!/$!', $path)) {
$path .= '/';
}
return $path;
}
示例4: smarty_function_mtwebsiteurl
function smarty_function_mtwebsiteurl($args, &$ctx)
{
// status: complete
// parameters: none
if (isset($args['id']) && is_numeric($args['id'])) {
require_once 'class.mt_website.php';
$blog = new Blog();
$ret = $blog->Load('blog_id = ' . $args['id']);
if (!$ret) {
$blog = null;
}
}
if (empty($blog)) {
$blog = $ctx->stash('blog');
}
if (empty($blog)) {
return '';
}
$website = $blog->is_blog() ? $blog->website() : $blog;
if (empty($website)) {
return '';
}
$url = $website->site_url();
if (!preg_match('!/$!', $url)) {
$url .= '/';
}
return $url;
}
示例5: fetch_blog
public function fetch_blog($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_blog.php';
$blog = new Blog();
$blog->Load("blog_id = {$blog_id}");
$this->_blog_id_cache[$blog_id] = $blog;
return $blog;
}
示例6: 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;
}