X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=fromgplus%2Ffromgplus.php;h=9fc13c5ec97e8bad1946831d7cf9a5514d938ae7;hb=f1514063559930de791c0bff18a3f6ae4b455f7c;hp=88d2622ff16fcf46306d47e919c336c082e4c5d5;hpb=ecb88c93f0403854858ef16ec0bb0ae52b73dd4f;p=friendica-addons.git diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 88d2622f..0a2b6802 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -1,20 +1,39 @@ * */ +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'); + 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'); + 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) { @@ -22,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 .= '