X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=fromgplus%2Ffromgplus.php;h=665590d34b6f1d163d8ae2eeb720a9acc6601b27;hb=7b6bc4777c95a9aed81c6d9e94aeea05d584236a;hp=5d0e86c3d92f00a3d5db725ad12ad3a9f270b99b;hpb=494318cb027f944254d31621729ce3d756252b18;p=friendica-addons.git diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 5d0e86c3..665590d3 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,16 +9,28 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes +use Friendica\Core\Config; +use Friendica\Core\PConfig; +use Friendica\Object\Photo; + +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 +38,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 .= '