Replace class name StatusNet > GNUsocial and getActivePlugins > getActiveModules

This commit is contained in:
SENOO, Ken 2022-10-15 15:56:19 +09:00
parent 7d07dd9861
commit a4005b8fa5
3 changed files with 17 additions and 17 deletions

View File

@ -568,7 +568,7 @@ class QvitterPlugin extends Plugin {
$enclosure_o = $attachment->getEnclosure(); $enclosure_o = $attachment->getEnclosure();
// Oembed // Oembed
if(array_key_exists('Oembed', StatusNet::getActivePlugins())) { if(array_key_exists('Oembed', GNUsocial::getActiveModules())) {
$oembed = File_oembed::getKV('file_id',$attachment->id); $oembed = File_oembed::getKV('file_id',$attachment->id);
if($oembed instanceof File_oembed) { if($oembed instanceof File_oembed) {
$oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags $oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags
@ -675,8 +675,8 @@ class QvitterPlugin extends Plugin {
// if this attachment has an url this might be a notice url // if this attachment has an url this might be a notice url
if (isset($attachment['url'])) { if (isset($attachment['url'])) {
$noticeurl = common_path('notice/', StatusNet::isHTTPS()); $noticeurl = common_path('notice/', GNUsocial::isHTTPS());
$instanceurl = common_path('', StatusNet::isHTTPS()); $instanceurl = common_path('', GNUsocial::isHTTPS());
// remove protocol for the comparison below // remove protocol for the comparison below
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl); $noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);
@ -1093,7 +1093,7 @@ class QvitterPlugin extends Plugin {
$user_is_deleted = true; $user_is_deleted = true;
} }
if(!$user_is_deleted && class_exists('StatusNet') && !array_key_exists('ActivityModeration', StatusNet::getActivePlugins())) { if(!$user_is_deleted && class_exists('GNUsocial') && !array_key_exists('ActivityModeration', GNUsocial::getActiveModules())) {
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'), $rendered = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
htmlspecialchars($profile->getUrl()), htmlspecialchars($profile->getUrl()),
htmlspecialchars($profile->getBestName()), htmlspecialchars($profile->getBestName()),
@ -1131,7 +1131,7 @@ class QvitterPlugin extends Plugin {
public function onEndHandleFeedEntry($activity): bool { public function onEndHandleFeedEntry($activity): bool {
if($activity->verb == 'qvitter-delete-notice' && class_exists('StatusNet') && !array_key_exists('ActivityModeration', StatusNet::getActivePlugins())) { if($activity->verb == 'qvitter-delete-notice' && class_exists('GNUsocial') && !array_key_exists('ActivityModeration', GNUsocial::getActiveModules())) {
$deleter_profile_uri = $activity->actor->id; $deleter_profile_uri = $activity->actor->id;
$deleted_notice_uri = $activity->objects[0]->objects[0]->content; $deleted_notice_uri = $activity->objects[0]->objects[0]->content;
@ -1417,7 +1417,7 @@ class QvitterPlugin extends Plugin {
} }
} }
if($largest_avatar['size']>0) { if($largest_avatar['size']>0) {
$origurl = common_path('', StatusNet::isHTTPS()).$largest_avatar['name']; $origurl = common_path('', GNUsocial::isHTTPS()).$largest_avatar['name'];
} else { } else {
$origurl = $twitter_user['profile_image_url_profile_size']; $origurl = $twitter_user['profile_image_url_profile_size'];
} }

View File

@ -74,8 +74,8 @@ class ApiQvitterOembedNoticeAction extends ApiAction
{ {
parent::handle(); parent::handle();
$noticeurl = common_path('notice/', StatusNet::isHTTPS()); $noticeurl = common_path('notice/', GNUsocial::isHTTPS());
$instanceurl = common_path('', StatusNet::isHTTPS()); $instanceurl = common_path('', GNUsocial::isHTTPS());
// remove protocol for the comparison below // remove protocol for the comparison below
$noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl); $noticeurl_wo_protocol = preg_replace('(^https?://)', '', $noticeurl);

View File

@ -97,20 +97,20 @@ class QvitterAction extends ApiAction
$sitetitle = common_config('site','name'); $sitetitle = common_config('site','name');
$siterootdomain = common_config('site','server'); $siterootdomain = common_config('site','server');
$qvitterpath = Plugin::staticPath('Qvitter', ''); $qvitterpath = Plugin::staticPath('Qvitter', '');
$apiroot = common_path('api/', StatusNet::isHTTPS()); $apiroot = common_path('api/', GNUsocial::isHTTPS());
$instanceurl = common_path('', StatusNet::isHTTPS()); $instanceurl = common_path('', GNUsocial::isHTTPS());
$favicon_path = QvitterPlugin::settings("favicon_path"); $favicon_path = QvitterPlugin::settings("favicon_path");
$attachmentconfig=common_config('attachments'); $attachmentconfig=common_config('attachments');
if(StatusNet::isHTTPS() && $attachmentconfig['sslserver']){ if(GNUsocial::isHTTPS() && $attachmentconfig['sslserver']){
$attachmentroot ='https://'.$attachmentconfig['sslserver'].$attachmentconfig['path']; $attachmentroot ='https://'.$attachmentconfig['sslserver'].$attachmentconfig['path'];
} elseif(!StatusNet::isHTTPS() && $attachmentconfig['server']) { } elseif(!GNUsocial::isHTTPS() && $attachmentconfig['server']) {
$attachmentroot ='http://'.$attachmentconfig['server'].$attachmentconfig['path']; $attachmentroot ='http://'.$attachmentconfig['server'].$attachmentconfig['path'];
} else { } else {
$attachmentroot = $instanceurl.$attachmentconfig['path']; $attachmentroot = $instanceurl.$attachmentconfig['path'];
} }
$avatarconfig=common_config('avatar'); $avatarconfig=common_config('avatar');
if($avatarconfig['server']) { if($avatarconfig['server']) {
if(StatusNet::isHTTPS() ){ if(GNUsocial::isHTTPS() ){
$avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path']; $avatarroot ='https://'.$avatarconfig['server'].$avatarconfig['path'];
} else { } else {
$avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path']; $avatarroot ='http://'.$avatarconfig['server'].$avatarconfig['path'];
@ -206,7 +206,7 @@ class QvitterAction extends ApiAction
} }
// maybe openid // maybe openid
if (array_key_exists('OpenID', StatusNet::getActivePlugins())) { if (array_key_exists('OpenID', GNUsocial::getActiveModules())) {
print ' <link rel="openid2.provider" href="'.common_local_url('openidserver').'"/>'."\n"; print ' <link rel="openid2.provider" href="'.common_local_url('openidserver').'"/>'."\n";
print ' <link rel="openid2.local_id" href="'.$user->getProfile()->profileurl.'"/>'."\n"; print ' <link rel="openid2.local_id" href="'.$user->getProfile()->profileurl.'"/>'."\n";
print ' <link rel="openid2.server" href="'.common_local_url('openidserver').'"/>'."\n"; print ' <link rel="openid2.server" href="'.common_local_url('openidserver').'"/>'."\n";
@ -246,7 +246,7 @@ class QvitterAction extends ApiAction
// oembed discovery for local notices, and twitter cards // oembed discovery for local notices, and twitter cards
if(substr($_SERVER['REQUEST_URI'],0,8) == '/notice/' if(substr($_SERVER['REQUEST_URI'],0,8) == '/notice/'
&& $this->arg('notice') && $this->arg('notice')
&& array_key_exists('Oembed', StatusNet::getActivePlugins())) { && array_key_exists('Oembed', GNUsocial::getActiveModules())) {
$notice = Notice::getKV('id', $this->arg('notice')); $notice = Notice::getKV('id', $this->arg('notice'));
if($notice instanceof Notice) { if($notice instanceof Notice) {
@ -371,7 +371,7 @@ class QvitterAction extends ApiAction
window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>; window.timeBetweenPolling = <?php print QvitterPlugin::settings("timebetweenpolling"); ?>;
window.apiRoot = <?php window.apiRoot = <?php
$api_root = common_path("api/", StatusNet::isHTTPS()); $api_root = common_path("api/", GNUsocial::isHTTPS());
if($this_site_thinks_it_is_http_but_is_actually_https) { if($this_site_thinks_it_is_http_but_is_actually_https) {
$api_root = str_replace('http://','https://',$api_root); $api_root = str_replace('http://','https://',$api_root);
} }
@ -645,7 +645,7 @@ class QvitterAction extends ApiAction
<input type="hidden" id="token" name="token" value="<?php print common_session_token(); ?>"> <input type="hidden" id="token" name="token" value="<?php print common_session_token(); ?>">
<?php <?php
if (array_key_exists('OpenID', StatusNet::getActivePlugins())) { if (array_key_exists('OpenID', GNUsocial::getActiveModules())) {
print '<a href="'.$instanceurl.'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>'; print '<a href="'.$instanceurl.'main/openid" id="openid-login" title="OpenID" donthijack>OpenID</a>';
} }