forked from GNUsocial/gnu-social
move class BlogEntry to Blog_entry for DB_DataObject compliance
This commit is contained in:
parent
4c9ae4fae6
commit
d51abd8830
@ -62,7 +62,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
{
|
{
|
||||||
$schema = Schema::get();
|
$schema = Schema::get();
|
||||||
|
|
||||||
$schema->ensureTable('blog_entry', BlogEntry::schemaDef());
|
$schema->ensureTable('blog_entry', Blog_entry::schemaDef());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
case 'BlogEntryListItem':
|
case 'BlogEntryListItem':
|
||||||
include_once $dir . '/'.strtolower($cls).'.php';
|
include_once $dir . '/'.strtolower($cls).'.php';
|
||||||
return false;
|
return false;
|
||||||
case 'BlogEntry':
|
case 'Blog_entry':
|
||||||
include_once $dir . '/'.$cls.'.php';
|
include_once $dir . '/'.$cls.'.php';
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
@ -136,7 +136,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
function types()
|
function types()
|
||||||
{
|
{
|
||||||
return array(BlogEntry::TYPE);
|
return array(Blog_entry::TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveNoticeFromActivity($activity, $actor, $options=array())
|
function saveNoticeFromActivity($activity, $actor, $options=array())
|
||||||
@ -148,7 +148,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
$entryObj = $activity->objects[0];
|
$entryObj = $activity->objects[0];
|
||||||
|
|
||||||
if ($entryObj->type != BlogEntry::TYPE) {
|
if ($entryObj->type != Blog_entry::TYPE) {
|
||||||
// TRANS: Exception thrown when blog plugin comes across a non-event type object.
|
// TRANS: Exception thrown when blog plugin comes across a non-event type object.
|
||||||
throw new ClientException(_m('Wrong type for object.'));
|
throw new ClientException(_m('Wrong type for object.'));
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
switch ($activity->verb) {
|
switch ($activity->verb) {
|
||||||
case ActivityVerb::POST:
|
case ActivityVerb::POST:
|
||||||
$notice = BlogEntry::saveNew($actor,
|
$notice = Blog_entry::saveNew($actor,
|
||||||
$entryObj->title,
|
$entryObj->title,
|
||||||
$entryObj->content,
|
$entryObj->content,
|
||||||
$options);
|
$options);
|
||||||
@ -172,7 +172,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
function activityObjectFromNotice($notice)
|
function activityObjectFromNotice($notice)
|
||||||
{
|
{
|
||||||
$entry = BlogEntry::fromNotice($notice);
|
$entry = Blog_entry::fromNotice($notice);
|
||||||
|
|
||||||
if (empty($entry)) {
|
if (empty($entry)) {
|
||||||
throw new ClientException(sprintf(_('No blog entry for notice %s'),
|
throw new ClientException(sprintf(_('No blog entry for notice %s'),
|
||||||
@ -189,8 +189,8 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
|
|
||||||
function deleteRelated($notice)
|
function deleteRelated($notice)
|
||||||
{
|
{
|
||||||
if ($notice->object_type == BlogEntry::TYPE) {
|
if ($notice->object_type == Blog_entry::TYPE) {
|
||||||
$entry = BlogEntry::fromNotice($notice);
|
$entry = Blog_entry::fromNotice($notice);
|
||||||
if (exists($entry)) {
|
if (exists($entry)) {
|
||||||
$entry->delete();
|
$entry->delete();
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ class BlogPlugin extends MicroAppPlugin
|
|||||||
{
|
{
|
||||||
$notice = $nli->notice;
|
$notice = $nli->notice;
|
||||||
|
|
||||||
if ($notice->object_type == BlogEntry::TYPE) {
|
if ($notice->object_type == Blog_entry::TYPE) {
|
||||||
return new BlogEntryListItem($nli);
|
return new BlogEntryListItem($nli);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ if (!defined('STATUSNET')) {
|
|||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BlogEntry extends Managed_DataObject
|
class Blog_entry extends Managed_DataObject
|
||||||
{
|
{
|
||||||
public $__table = 'blog_entry';
|
public $__table = 'blog_entry';
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class BlogEntry extends Managed_DataObject
|
|||||||
$options = array();
|
$options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$be = new BlogEntry();
|
$be = new Blog_entry();
|
||||||
$be->id = (string) new UUID();
|
$be->id = (string) new UUID();
|
||||||
$be->profile_id = $profile->id;
|
$be->profile_id = $profile->id;
|
||||||
$be->title = htmlspecialchars($title);
|
$be->title = htmlspecialchars($title);
|
||||||
@ -209,7 +209,7 @@ class BlogEntry extends Managed_DataObject
|
|||||||
|
|
||||||
static function fromNotice($notice)
|
static function fromNotice($notice)
|
||||||
{
|
{
|
||||||
return BlogEntry::staticGet('uri', $notice->uri);
|
return Blog_entry::staticGet('uri', $notice->uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotice()
|
function getNotice()
|
@ -61,7 +61,7 @@ class BlogEntryListItem extends NoticeListItemAdapter
|
|||||||
$notice = $this->nli->notice;
|
$notice = $this->nli->notice;
|
||||||
$out = $this->nli->out;
|
$out = $this->nli->out;
|
||||||
|
|
||||||
$entry = BlogEntry::fromNotice($notice);
|
$entry = Blog_entry::fromNotice($notice);
|
||||||
|
|
||||||
if (empty($entry)) {
|
if (empty($entry)) {
|
||||||
throw new Exception('BlogEntryListItem used for non-blog notice.');
|
throw new Exception('BlogEntryListItem used for non-blog notice.');
|
||||||
|
@ -114,7 +114,7 @@ class NewblogentryAction extends Action
|
|||||||
|
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
$saved = BlogEntry::saveNew($profile,
|
$saved = Blog_entry::saveNew($profile,
|
||||||
$this->title,
|
$this->title,
|
||||||
$this->content,
|
$this->content,
|
||||||
$options);
|
$options);
|
||||||
|
@ -54,7 +54,7 @@ class ShowblogentryAction extends ShownoticeAction
|
|||||||
{
|
{
|
||||||
$this->id = $this->trimmed('id');
|
$this->id = $this->trimmed('id');
|
||||||
|
|
||||||
$this->entry = BlogEntry::staticGet('id', $this->id);
|
$this->entry = Blog_entry::staticGet('id', $this->id);
|
||||||
|
|
||||||
if (empty($this->entry)) {
|
if (empty($this->entry)) {
|
||||||
// TRANS: Client exception thrown when referring to a non-existing blog entry.
|
// TRANS: Client exception thrown when referring to a non-existing blog entry.
|
||||||
|
Loading…
Reference in New Issue
Block a user