]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Blog/BlogPlugin.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / plugins / Blog / BlogPlugin.php
index 7f8e8fd1d0b37700a16563d0fa666ca6b4388e8a..eb1f5833c49eaf754692b935e7fbaf0b5b58a4ec 100644 (file)
@@ -62,7 +62,7 @@ class BlogPlugin extends MicroAppPlugin
     {
         $schema = Schema::get();
 
-        $schema->ensureTable('blog_entry', BlogEntry::schemaDef());
+        $schema->ensureTable('blog_entry', Blog_entry::schemaDef());
 
         return true;
     }
@@ -88,7 +88,7 @@ class BlogPlugin extends MicroAppPlugin
         case 'BlogEntryListItem':
             include_once $dir . '/'.strtolower($cls).'.php';
             return false;
-        case 'BlogEntry':
+        case 'Blog_entry':
             include_once $dir . '/'.$cls.'.php';
             return false;
         default:
@@ -120,13 +120,15 @@ class BlogPlugin extends MicroAppPlugin
                             'author' => 'Evan Prodromou',
                             'homepage' => 'http://status.net/wiki/Plugin:Blog',
                             'rawdescription' =>
+                            // TRANS: Plugin description.
                             _m('Let users write and share long-form texts.'));
         return true;
     }
 
     function appTitle()
     {
-        return _m('Blog');
+        // TRANS: Blog application title.
+        return _m('TITLE','Blog');
     }
 
     function tag()
@@ -136,7 +138,7 @@ class BlogPlugin extends MicroAppPlugin
 
     function types()
     {
-        return array(BlogEntry::TYPE);
+        return array(Blog_entry::TYPE);
     }
 
     function saveNoticeFromActivity($activity, $actor, $options=array())
@@ -148,8 +150,8 @@ class BlogPlugin extends MicroAppPlugin
 
         $entryObj = $activity->objects[0];
 
-        if ($entryObj->type != BlogEntry::TYPE) {
-            // TRANS: Exception thrown when blog plugin comes across a non-event type object.
+        if ($entryObj->type != Blog_entry::TYPE) {
+            // TRANS: Exception thrown when blog plugin comes across a non-blog entry type object.
             throw new ClientException(_m('Wrong type for object.'));
         }
 
@@ -157,7 +159,7 @@ class BlogPlugin extends MicroAppPlugin
 
         switch ($activity->verb) {
         case ActivityVerb::POST:
-            $notice = BlogEntry::saveNew($actor,
+            $notice = Blog_entry::saveNew($actor,
                                          $entryObj->title,
                                          $entryObj->content,
                                          $options);
@@ -172,10 +174,11 @@ class BlogPlugin extends MicroAppPlugin
 
     function activityObjectFromNotice($notice)
     {
-        $entry = BlogEntry::fromNotice($notice);
+        $entry = Blog_entry::fromNotice($notice);
 
         if (empty($entry)) {
-            throw new ClientException(sprintf(_('No blog entry for notice %s'),
+            // TRANS: Exception thrown when requesting a non-existing blog entry for notice.
+            throw new ClientException(sprintf(_m('No blog entry for notice %s.'),
                         $notice->id));
         }
 
@@ -189,9 +192,9 @@ class BlogPlugin extends MicroAppPlugin
 
     function deleteRelated($notice)
     {
-        if ($notice->object_type == BlogEntry::TYPE) {
-            $entry = BlogEntry::fromNotice($notice);
-            if (exists($entry)) {
+        if ($notice->object_type == Blog_entry::TYPE) {
+            $entry = Blog_entry::fromNotice($notice);
+            if (!empty($entry)) {
                 $entry->delete();
             }
         }
@@ -201,10 +204,19 @@ class BlogPlugin extends MicroAppPlugin
     {
         $notice = $nli->notice;
 
-        if ($notice->object_type == BlogEntry::TYPE) {
+        if ($notice->object_type == Blog_entry::TYPE) {
             return new BlogEntryListItem($nli);
         }
-        
+
         return null;
     }
+
+    function onEndShowScripts($action)
+    {
+        $action->script(common_path('plugins/TinyMCE/js/jquery.tinymce.js'));
+        $action->inlineScript('var _tinymce_path = "'.common_path('plugins/TinyMCE/js/tiny_mce.js').'";'."\n".
+                              'var _tinymce_placeholder = "'.common_path('plugins/TinyMCE/icons/placeholder.png').'";'."\n");
+        $action->script($this->path('blog.js'));
+        return true;
+    }
 }