X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=randplace%2Frandplace.php;h=ffc3237c3d007f129d907e0256df9a423fe7d079;hb=101d3603245b17bd2e6d4880e94bb27887257238;hp=b696bed2e7749af96bdfbfd3c470eb6581efda7f;hpb=27b60e003f92dd9f3aebbeddb34ebb905488ca82;p=friendica-addons.git diff --git a/randplace/randplace.php b/randplace/randplace.php index b696bed2..ffc3237c 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -1,7 +1,7 @@ * @@ -11,39 +11,41 @@ * Addons are registered with the system through the admin * panel. * - * When registration is detected, the system calls the plugin + * When registration is detected, 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\Hook; +use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function randplace_install() { /** * - * Our demo plugin will attach in three places. + * Our demo addon will attach in three places. * The first is just prior to storing a local post. * */ - register_hook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); + Hook::register('post_local', 'addon/randplace/randplace.php', 'randplace_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/randplace/randplace.php', 'randplace_settings'); - register_hook('plugin_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + Hook::register('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + Hook::register('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - logger("installed randplace"); + Logger::log("installed randplace"); } @@ -57,12 +59,12 @@ function randplace_uninstall() { * */ - unregister_hook('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); - unregister_hook('plugin_settings', 'addon/randplace/randplace.php', 'randplace_settings'); - unregister_hook('plugin_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); + Hook::unregister('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); + Hook::unregister('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); + Hook::unregister('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - logger("removed randplace"); + Logger::log("removed randplace"); } @@ -74,11 +76,11 @@ function randplace_post_hook($a, &$item) { * 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 * */ - logger('randplace invoked'); + Logger::log('randplace invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; @@ -142,7 +144,7 @@ function randplace_settings_post($a,$post) { /** * - * Called from the Plugin Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ @@ -156,7 +158,7 @@ function randplace_settings(&$a,&$s) { /* Add our stylesheet to the page so we can make our settings look nice */ - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; /* Get the current state of our config variable */ @@ -167,14 +169,14 @@ function randplace_settings(&$a,&$s) { /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Randplace Settings') . '

'; + $s .= '

' . L10n::t('Randplace Settings') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; /* provide a submit button */ - $s .= '
'; + $s .= '
'; }