X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=fromgplus%2Ffromgplus.php;h=0a2b680227a05007af5773838abe1b0fb1cefbd5;hb=f1514063559930de791c0bff18a3f6ae4b455f7c;hp=4c2718737d8986ae7e6155f283b8a9d18b75cb69;hpb=191c22f7093b50d04868f0ebdbed1d2ad4955eab;p=friendica-addons.git diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 4c271873..0a2b6802 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,16 +9,31 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes +use Friendica\Core\Addon; +use Friendica\Core\Config; +use Friendica\Core\L10n; +use Friendica\Core\PConfig; +use Friendica\Object\Image; +use Friendica\Util\Network; + +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('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); + Addon::registerHook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); + Addon::registerHook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); + Addon::registerHook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); } function fromgplus_uninstall() { - 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'); + Addon::unregisterHook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); + Addon::unregisterHook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); + Addon::unregisterHook('cron', 'addon/fromgplus/fromgplus.php', 'fromgplus_cron'); + + // Old hooks + Addon::unregisterHook('addon_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); + Addon::unregisterHook('addon_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); } function fromgplus_addon_settings(&$a,&$s) { @@ -26,22 +41,37 @@ 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 .= '

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

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