本文整理汇总了PHP中Blog类的典型用法代码示例。如果您正苦于以下问题:PHP Blog类的具体用法?PHP Blog怎么用?PHP Blog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Blog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:28,代码来源:function.mtwebsiteurl.php
示例2: 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;
}
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:25,代码来源:function.mtblogarchiveurl.php
示例3: __construct
public function __construct($data)
{
if (isset($data['session'])) {
$guid = $data['guid'];
$title = $data['blog_title'];
$description = $data['description'];
$access_id = $data['access_id'];
$user = getUserFromSession($data['session']);
if (!$guid) {
$blog = new Blog();
$blog->owner_guid = $user->guid;
$blog->save();
} else {
$blog = getEntity($guid);
}
if ($blog->owner_guid == $user->guid) {
$blog->title = $title;
$blog->description = $description;
$blog->access_id = $access_id;
$blog->status = "draft";
$guid = $blog->save();
$blog = getEntity($guid);
echo json_encode(array("guid" => $guid, "timeago" => display("output/friendly_time", array("timestamp" => $blog->last_updated))));
}
}
}
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:26,代码来源:SaveBlogDraftActionHandler.php
示例4: __construct
public function __construct()
{
gateKeeper();
$guid = getInput("guid");
$title = getInput("blog_title");
$description = getInput("description");
$access_id = getInput("access_id");
$container_guid = getInput("container_guid");
$owner_guid = getLoggedInUserGuid();
if ($guid) {
$blog = getEntity($guid);
} else {
$blog = new Blog();
}
$blog->title = $title;
$blog->description = $description;
$blog->access_id = $access_id;
$blog->owner_guid = $owner_guid;
$blog->status = "published";
$blog->container_guid = $container_guid;
$blog->save();
new Activity(getLoggedInUserGuid(), "blog:add", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $blog->getURL(), $blog->title, truncate($blog->description)), "", $access_id);
new SystemMessage("Your blog has been published");
forward("blogs/all_blogs");
}
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:AddBlogActionHandler.php
示例5: 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;
}
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:26,代码来源:function.mtwebsitepath.php
示例6: 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 '';
}
}
开发者ID:OCMO,项目名称:movabletype,代码行数:31,代码来源:function.mtwebsiterelativeurl.php
示例7: delete
public function delete($id)
{
$Blog = new Blog($this->table_name, $this->action);
$sql = $Blog->destroy($id);
mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
header("Location: ../index");
}
开发者ID:amico8,项目名称:seed_framework,代码行数:7,代码来源:blogs_controller.php
示例8: view
public function view($query)
{
$blog = new Blog();
$params = array('blog' => $blog->find($query[0]));
$this->setParams('params', $params);
$this->render();
}
开发者ID:gitter-badger,项目名称:Mist-1,代码行数:7,代码来源:BlogController.php
示例9: showAction
public function showAction(array $params)
{
$blogModel = new Blog();
$blog = $blogModel->getById($params['id']);
$data = array('content' => $blog);
return $this->render('show', $data);
}
开发者ID:OlehGit,项目名称:mydemo,代码行数:7,代码来源:IndexController.php
示例10: delete
public function delete($id)
{
$Blog = new Blog($this->plural_resource);
$sql = $Blog->destroy($id);
mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
header("Location: ../index");
}
开发者ID:KoichiTakashiro,项目名称:geechscamp,代码行数:7,代码来源:blogs_controller.php
示例11: login
public function login(Blog $blog)
{
$this->setAuthenticated(true);
$this->setAttribute('id', $blog->getId(), 'user');
$this->setAttribute('mid', $blog->getMid(), 'user');
$this->setAttribute('name', $blog->getAuthor(), 'user');
}
开发者ID:noose,项目名称:Planeta,代码行数:7,代码来源:myUser.class.php
示例12: blogs
function blogs()
{
$where = "blog_parent_id = " . $this->id;
require_once 'class.mt_blog.php';
$blog = new Blog();
$blogs = $blog->Find($where);
return $blogs;
}
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:8,代码来源:class.mt_website.php
示例13: getNewestTimestamp
public static function getNewestTimestamp(Blog $blog)
{
$c = new Criteria();
$c->addDescendingOrderByColumn(PostPeer::CREATED_AT);
$c->add(PostPeer::BLOG_ID, $blog->getId());
$post = PostPeer::doSelectOne($c);
return $post ? $post->getCreatedAt(null) : 0;
}
开发者ID:noose,项目名称:Planeta,代码行数:8,代码来源:PostPeer.php
示例14: newPost
public function newPost($title, $content, $user_id)
{
$blog = new Blog();
$blog->newPost($title, $content, $user_id);
echo "Vaša objava je shranjena";
$view = new blogView();
$view->renderSavedPost();
}
开发者ID:ElaGia,项目名称:SmartNinjaPhp,代码行数:8,代码来源:blogController.php
示例15: testUpdatePostTitle
public function testUpdatePostTitle()
{
$blog = new Blog($this->pdo);
$blog->update_post_title(0, "Test Title Update");
$result = $this->getConnection()->createQueryTable("posts", "SELECT id, title FROM posts\n WHERE id = 0");
$expected = $this->createFlatXmlDataSet("seeds/expectedUpdatePostTitle.xml")->getTable("posts");
$this->assertTablesEqual($expected, $result);
}
开发者ID:cpgillem,项目名称:cadegillem.me,代码行数:8,代码来源:BlogTest.php
示例16: get_posts
/**
*
* @param int $limit [description]
* @return array
*/
public static function get_posts($limit = false)
{
$blog = new Blog('posts/');
// Get drafted posts as well
if (User::is_logged_in()) {
return $blog->getAllPosts($limit);
}
return $blog->getPosts($limit);
}
开发者ID:stojg,项目名称:puny,代码行数:14,代码来源:Blog.php
示例17: delete
public function delete()
{
$Blog = new Blog($this->plural_resorce, $this->option, $this->db);
$sql = $Blog->delete();
var_dump($sql);
mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
header('Location:../index');
exit;
}
开发者ID:hiroki0325,项目名称:geechscamp,代码行数:9,代码来源:blogs_contllorer.php
示例18: visitBlog
function visitBlog(Blog $b)
{
$pages = $b->getPages();
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<blog>';
foreach ($pages as $pa) {
$pa->accept($this);
}
echo '</blog>';
}
开发者ID:laiello,项目名称:abbov,代码行数:10,代码来源:xmlvisitor.php
示例19: blogs
function blogs()
{
if ($this->class == 'blog') {
return null;
}
$where = "blog_parent_id = " . $this->id;
$blog = new Blog();
$blogs = $blog->Find($where);
return $blogs;
}
开发者ID:OCMO,项目名称:movabletype,代码行数:10,代码来源:class.mt_blog.php
示例20: visitBlog
function visitBlog(Blog $b)
{
$page = $b->getPage($this->_id);
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
echo "<html><head>";
echo '<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1">';
echo "<title>" . $b->getTitle() . "</title>";
echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="http://' . $_SERVER['SERVER_NAME'] . $this->_rootfolder . 'rss.php">';
echo "</head><body>";
$page->accept($this);
echo "</body></html>";
}
开发者ID:laiello,项目名称:abbov,代码行数:12,代码来源:pagevisitor.php
注:本文中的Blog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论