* $a->config['geonames']['username'] = 'your_username';
* Also visit http://geonames.org/manageaccount and enable access to the free web services
*
- * When plugin is installed, the system calls the plugin
+ * When addon is installed, the system calls the addon
* name_install() function, located in 'addon/name/name.php',
* where 'name' is the name of the addon.
* If the addon is removed from the configuration list, the
* system will call the name_uninstall() function.
*
*/
-
+use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
/**
*
- * Our plugin will attach in three places.
+ * Our addon will attach in three places.
* The first is just prior to storing a local post.
*
*/
- register_hook('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
+ Addon::registerHook('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
/**
*
- * Then we'll attach into the plugin settings page, and also the
+ * Then we'll attach into the addon settings page, and also the
* settings post hook so that we can create and update
* user preferences.
*
*/
- register_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_plugin_admin');
- register_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_plugin_admin_post');
+ Addon::registerHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
+ Addon::registerHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
logger("installed geonames");
}
*
*/
- unregister_hook('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
- unregister_hook('plugin_settings', 'addon/geonames/geonames.php', 'geonames_plugin_admin');
- unregister_hook('plugin_settings_post', 'addon/geonames/geonames.php', 'geonames_plugin_admin_post');
+ Addon::unregisterHook('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
+ Addon::unregisterHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
+ Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
logger("removed geonames");
* An item was posted on the local system.
* We are going to look for specific items:
* - A status post by a profile owner
- * - The profile owner must have allowed our plugin
+ * - The profile owner must have allowed our addon
*
*/
*
*/
-function geonames_plugin_admin_post($a,$post) {
+function geonames_addon_admin_post($a,$post) {
if(! local_user() || (! x($_POST,'geonames-submit')))
return;
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));
/**
*
- * Called from the Plugin Setting form.
+ * Called from the Addon Setting form.
* Add our own settings info to the page.
*
*/
-function geonames_plugin_admin(&$a,&$s) {
+function geonames_addon_admin(&$a,&$s) {
if(! local_user())
return;
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Geonames Settings') . '</h3>';
$s .= '<div id="geonames-enable-wrapper">';
- $s .= '<label id="geonames-enable-label" for="geonames-checkbox">' . t('Enable Geonames Plugin') . '</label>';
+ $s .= '<label id="geonames-enable-label" for="geonames-checkbox">' . t('Enable Geonames Addon') . '</label>';
$s .= '<input id="geonames-checkbox" type="checkbox" name="geonames" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>';