X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=fromgplus%2Ffromgplus.php;h=984ab4b4677d9393e637b157eba4551280e35c6f;hb=c3e93f1ed9a487f823bcc75ddd43024334c25bfc;hp=59b20023fd177f15f86612f511582188f6696e58;hpb=a3253a3c85a2c80f24678f668d10c6f99e272ae5;p=friendica-addons.git diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 59b20023..984ab4b4 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,16 +9,27 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes +use Friendica\Core\Config; +use Friendica\Core\PConfig; + +require_once('mod/share.php'); +require_once('mod/parse_url.php'); +require_once('include/text.php'); + function fromgplus_install() { - register_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); - register_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); + register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); + register_hook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); register_hook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); } function fromgplus_uninstall() { + unregister_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); + unregister_hook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); + unregister_hook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); + + // Old hooks unregister_hook('plugin_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); unregister_hook('plugin_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); - unregister_hook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); } function fromgplus_addon_settings(&$a,&$s) { @@ -26,11 +37,23 @@ function fromgplus_addon_settings(&$a,&$s) { if(! local_user()) return; - $enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : ''); - $account = get_pconfig(local_user(),'fromgplus','account'); + // If "gpluspost" is installed as well, then the settings are displayed there + $result = q("SELECT `installed` FROM `addon` WHERE `name` = 'gpluspost' AND `installed`"); + if (count($result) > 0) + return; + + $enable_checked = (intval(PConfig::get(local_user(),'fromgplus','enable')) ? ' checked="checked"' : ''); + $keywords_checked = (intval(PConfig::get(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : ''); + $account = PConfig::get(local_user(),'fromgplus','account'); + + $s .= ''; + $s .= '

'. t('Google+ Mirror').'

'; + $s .= '
'; + $s .= '