X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=windowsphonepush%2Fwindowsphonepush.php;h=bf160f0a4b1fcb949e0641cc482b6222202faf59;hb=2dbcc42384b85e5253b939f528236f41909b1596;hp=1d9dd27d9cfa54937fdaf044a8b55af3862efdc2;hpb=1eb23e3667ac780ea59bad219fb1e3a0517421d9;p=friendica-addons.git
diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php
index 1d9dd27d..bf160f0a 100644
--- a/windowsphonepush/windowsphonepush.php
+++ b/windowsphonepush/windowsphonepush.php
@@ -30,11 +30,11 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
+use Friendica\Model\Post;
use Friendica\Model\User;
function windowsphonepush_install()
@@ -56,18 +56,6 @@ function windowsphonepush_install()
Logger::log("installed windowsphonepush");
}
-function windowsphonepush_uninstall()
-{
- /* uninstall unregisters any hooks created with register_hook
- * during install. Don't delete data in table `pconfig`.
- */
- Hook::unregister('cron', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_cron');
- Hook::unregister('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings');
- Hook::unregister('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post');
-
- Logger::log("removed windowsphonepush");
-}
-
/* declare the windowsphonepush function so that /windowsphonepush url requests will land here */
function windowsphonepush_module()
{
@@ -92,8 +80,6 @@ function windowsphonepush_settings_post($a, $post)
}
DI::pConfig()->set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
-
- info(L10n::t('WindowsPhonePush settings updated.') . EOL);
}
/* Called from the Addon Setting form.
@@ -119,20 +105,20 @@ function windowsphonepush_settings(&$a, &$s)
/* Add some HTML to the existing form */
$s .= '
';
/* provide a submit button - enable und senditemtext can be changed by the user */
- $s .= '';
+ $s .= '';
/* provide further read-only information concerning the addon (useful for */
$s .= '
';
@@ -164,7 +150,7 @@ function windowsphonepush_cron()
} else {
// retrieve the number of unseen items and the id of the latest one (if there are more than
// one new entries since last poller run, only the latest one will be pushed)
- $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `item` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid']));
+ $count = q("SELECT count(`id`) as count, max(`id`) as max FROM `post-view` WHERE `unseen` = 1 AND `type` <> 'activity' AND `uid` = %d", intval($rr['uid']));
// send number of unseen items to the device (the number will be displayed on Start screen until
// App will be started by user) - this update will be sent every 10 minutes to update the number to 0 if
@@ -199,7 +185,7 @@ function windowsphonepush_cron()
$senditemtext = DI::pConfig()->get($rr['uid'], 'windowsphonepush', 'senditemtext');
if ($senditemtext == 1) {
// load item with the max id
- $item = Item::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]);
+ $item = Post::selectFirst(['author-name', 'body'], ['id' => $count[0]['max']]);
// as user allows to send the item, we want to show the sender of the item in the toast
// toasts are limited to one line, therefore place is limited - author shall be in
@@ -215,7 +201,7 @@ function windowsphonepush_cron()
if (substr($body, 0, 4) == "[url") {
$body = "URL/Image ...";
} else {
- $body = BBCode::convert($body, false, 2, true);
+ $body = BBCode::convert($body, false, BBCode::API, true);
$body = HTML::toPlaintext($body, 0);
$body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
}