class BlogPlugin extends MicroAppPlugin
{
+
+ var $oldSaveNew = true;
+
/**
* Database schema setup
*
return true;
}
-
- /**
- * Load related modules when needed
- *
- * @param string $cls Name of the class to be loaded
- *
- * @return boolean hook value; true means continue processing, false means stop.
- */
- function onAutoload($cls)
- {
- $dir = dirname(__FILE__);
-
- switch ($cls)
- {
- case 'NewblogentryAction':
- case 'ShowblogentryAction':
- include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
- return false;
- case 'BlogEntryForm':
- case 'BlogEntryListItem':
- include_once $dir . '/'.strtolower($cls).'.php';
- return false;
- case 'Blog_entry':
- include_once $dir . '/'.$cls.'.php';
- return false;
- default:
- return true;
- }
+
+ public function newFormAction(){
+ return 'newblogentry';
}
/**
* Map URLs to actions
*
- * @param Net_URL_Mapper $m path-to-action mapper
+ * @param URLMapper $m path-to-action mapper
*
* @return boolean hook value; true means continue processing, false means stop.
*/
- function onRouterInitialized($m)
+ public function onRouterInitialized(URLMapper $m)
{
$m->connect('blog/new',
array('action' => 'newblogentry'));
return true;
}
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$versions[] = array('name' => 'Blog',
- 'version' => STATUSNET_VERSION,
+ 'version' => GNUSOCIAL_VERSION,
'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:Blog',
'rawdescription' =>
function tag()
{
- return 'blog';
+ return 'blogentry';
}
function types()
return array(Blog_entry::TYPE);
}
- function saveNoticeFromActivity($activity, $actor, $options=array())
+ function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
{
if (count($activity->objects) != 1) {
// TRANS: Exception thrown when there are too many activity objects.
return $notice;
}
- function activityObjectFromNotice($notice)
+ function activityObjectFromNotice(Notice $notice)
{
$entry = Blog_entry::fromNotice($notice);
return new BlogEntryForm($out);
}
- function deleteRelated($notice)
+ function deleteRelated(Notice $notice)
{
if ($notice->object_type == Blog_entry::TYPE) {
$entry = Blog_entry::fromNotice($notice);
- if (exists($entry)) {
+ if (!empty($entry)) {
$entry->delete();
}
}
return null;
}
- function onEndShowScripts($action)
+ function onEndShowScripts(Action $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".