use Friendica\BaseModule;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Item;
-use Friendica\Model\Term;
+use Friendica\Model\Post;
+use Friendica\Model\Tag;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException;
use Friendica\Util\DateTimeFormat;
Hook::register('addon_settings' , __FILE__, 'advancedcontentfilter_addon_settings');
Hook::add('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition');
- DBStructure::update($a->getBasePath(), false, true);
+ DBStructure::performUpdate();
Logger::log("installed advancedcontentfilter");
}
-function advancedcontentfilter_uninstall()
-{
- Hook::unregister('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition');
- Hook::unregister('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter');
- Hook::unregister('addon_settings' , __FILE__, 'advancedcontentfilter_addon_settings');
-}
-
/*
* Hooks
*/
try {
$fields = advancedcontentfilter_build_fields($data);
} catch (Exception $e) {
- throw new HTTPException\BadRequestException($e->getMessage(), 0, $e);
+ throw new HTTPException\BadRequestException($e->getMessage(), $e);
}
if (empty($fields['name']) || empty($fields['expression'])) {
try {
$fields = advancedcontentfilter_build_fields($data);
} catch (Exception $e) {
- throw new HTTPException\BadRequestException($e->getMessage(), 0, $e);
+ throw new HTTPException\BadRequestException($e->getMessage(), $e);
}
if (!DBA::update('advancedcontentfilter_rules', $fields, ['id' => $args['id']])) {
- throw new HTTPException\ServiceUnavaiableException(DBA::errorMessage());
+ throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
}
return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]);
}
if (!DBA::delete('advancedcontentfilter_rules', ['id' => $args['id']])) {
- throw new HTTPException\ServiceUnavaiableException(DBA::errorMessage());
+ throw new HTTPException\ServiceUnavailableException(DBA::errorMessage());
}
return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]);
$condition = ["`guid` = ? AND (`uid` = ? OR `uid` = 0)", $args['guid'], local_user()];
$params = ['order' => ['uid' => true]];
- $item = Item::selectFirstForUser(local_user(), [], $condition, $params);
+ $item = Post::selectFirstForUser(local_user(), [], $condition, $params);
if (!DBA::isResult($item)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown post with guid: %s', $args['guid']));
}
- $tags = Term::populateTagsFromItem($item);
+ $tags = Tag::populateFromItem($item);
$item['tags'] = $tags['tags'];
$item['hashtags'] = $tags['hashtags'];