Merge pull request #497 from zeroadam/feature/L10n

Move pgettext to src
This commit is contained in:
Hypolite Petovan 2018-01-24 11:49:09 -05:00 committed by GitHub
commit 7ab2479166
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 1061 additions and 984 deletions

View file

@ -51,6 +51,7 @@
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function blackout_install() { function blackout_install() {
Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
@ -98,7 +99,7 @@ function blackout_addon_admin(&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/blackout/" ); $t = get_markup_template( "admin.tpl", "addon/blackout/" );
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"], '$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"],
'$startdate' => ["startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"], '$startdate' => ["startdate", "Begin of the Blackout<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"],
'$enddate' => ["enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""], '$enddate' => ["enddate", "End of the Blackout<br />(YYYY-MM-DD hh:mm)", $myend, ""],

View file

@ -7,9 +7,11 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function blockem_install() { function blockem_install()
{
Addon::registerHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); Addon::registerHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
Addon::registerHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); Addon::registerHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
Addon::registerHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); Addon::registerHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
@ -19,7 +21,8 @@ function blockem_install() {
Addon::registerHook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store'); Addon::registerHook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store');
} }
function blockem_uninstall() { function blockem_uninstall()
{
Addon::unregisterHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body'); Addon::unregisterHook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
Addon::unregisterHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item'); Addon::unregisterHook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
Addon::unregisterHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings'); Addon::unregisterHook('addon_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
@ -45,19 +48,19 @@ function blockem_addon_settings(&$a, &$s)
$words = ''; $words = '';
$s .= '<span id="settings_blockem_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">'; $s .= '<span id="settings_blockem_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">';
$s .= '<h3>' . t('"Blockem"') . '</h3>'; $s .= '<h3>' . L10n::t('"Blockem"') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_blockem_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_blockem_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">';
$s .= '<h3>' . t('"Blockem"') . '</h3>'; $s .= '<h3>' . L10n::t('"Blockem"') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="blockem-wrapper">'; $s .= '<div id="blockem-wrapper">';
$s .= '<label id="blockem-label" for="blockem-words">' . t('Comma separated profile URLS to block') . ' </label>'; $s .= '<label id="blockem-label" for="blockem-words">' . L10n::t('Comma separated profile URLS to block') . ' </label>';
$s .= '<textarea id="blockem-words" type="text" name="blockem-words" >' . htmlspecialchars($words) . '</textarea>'; $s .= '<textarea id="blockem-words" type="text" name="blockem-words" >' . htmlspecialchars($words) . '</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blockem-submit" name="blockem-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blockem-submit" name="blockem-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
return; return;
@ -70,7 +73,7 @@ function blockem_addon_settings_post(&$a,&$b) {
if($_POST['blockem-submit']) { if($_POST['blockem-submit']) {
PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words'])); PConfig::set(local_user(),'blockem','words',trim($_POST['blockem-words']));
info( t('BLOCKEM Settings saved.') . EOL); info(L10n::t('BLOCKEM Settings saved.') . EOL);
} }
} }
@ -133,7 +136,7 @@ function blockem_prepare_body(&$a,&$b) {
} }
if($found) { if($found) {
$rnd = random_string(8); $rnd = random_string(8);
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>'; $b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . L10n::t('Blocked %s - Click to open/close', $word) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
} }
} }
@ -186,9 +189,9 @@ function blockem_item_photo_menu(&$a,&$b) {
} }
} }
if($blocked) if($blocked)
$b['menu'][ t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');'; $b['menu'][L10n::t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');';
else else
$b['menu'][ t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');'; $b['menu'][L10n::t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');';
} }
function blockem_module() {} function blockem_module() {}
@ -220,6 +223,6 @@ function blockem_init(&$a) {
} }
PConfig::set(local_user(),'blockem','words',$words); PConfig::set(local_user(),'blockem','words',$words);
info( t('blockem settings updated') . EOL ); info(L10n::t('blockem settings updated') . EOL );
killme(); killme();
} }

View file

@ -6,6 +6,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function blogger_install() function blogger_install()
@ -43,7 +44,7 @@ function blogger_jot_nets(&$a, &$b)
$bl_defpost = PConfig::get(local_user(), 'blogger', 'post_by_default'); $bl_defpost = PConfig::get(local_user(), 'blogger', 'post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. t('Post to blogger') . '</div>'; . L10n::t('Post to blogger') . '</div>';
} }
} }
@ -74,40 +75,40 @@ function blogger_settings(&$a, &$s)
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_blogger_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">'; $s .= '<span id="settings_blogger_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. L10n::t('Blogger Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_blogger_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_blogger_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_blogger_expanded\'); openClose(\'settings_blogger_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. t('Blogger Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/blogger.png" /><h3 class="connector">'. L10n::t('Blogger Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="blogger-enable-wrapper">'; $s .= '<div id="blogger-enable-wrapper">';
$s .= '<label id="blogger-enable-label" for="blogger-checkbox">' . t('Enable Blogger Post Addon') . '</label>'; $s .= '<label id="blogger-enable-label" for="blogger-checkbox">' . L10n::t('Enable Blogger Post Addon') . '</label>';
$s .= '<input id="blogger-checkbox" type="checkbox" name="blogger" value="1" ' . $checked . '/>'; $s .= '<input id="blogger-checkbox" type="checkbox" name="blogger" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-username-wrapper">'; $s .= '<div id="blogger-username-wrapper">';
$s .= '<label id="blogger-username-label" for="blogger-username">' . t('Blogger username') . '</label>'; $s .= '<label id="blogger-username-label" for="blogger-username">' . L10n::t('Blogger username') . '</label>';
$s .= '<input id="blogger-username" type="text" name="bl_username" value="' . $bl_username . '" />'; $s .= '<input id="blogger-username" type="text" name="bl_username" value="' . $bl_username . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-password-wrapper">'; $s .= '<div id="blogger-password-wrapper">';
$s .= '<label id="blogger-password-label" for="blogger-password">' . t('Blogger password') . '</label>'; $s .= '<label id="blogger-password-label" for="blogger-password">' . L10n::t('Blogger password') . '</label>';
$s .= '<input id="blogger-password" type="password" name="bl_password" value="' . $bl_password . '" />'; $s .= '<input id="blogger-password" type="password" name="bl_password" value="' . $bl_password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-blog-wrapper">'; $s .= '<div id="blogger-blog-wrapper">';
$s .= '<label id="blogger-blog-label" for="blogger-blog">' . t('Blogger API URL') . '</label>'; $s .= '<label id="blogger-blog-label" for="blogger-blog">' . L10n::t('Blogger API URL') . '</label>';
$s .= '<input id="blogger-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />'; $s .= '<input id="blogger-blog" type="text" name="bl_blog" value="' . $bl_blog . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="blogger-bydefault-wrapper">'; $s .= '<div id="blogger-bydefault-wrapper">';
$s .= '<label id="blogger-bydefault-label" for="blogger-bydefault">' . t('Post to Blogger by default') . '</label>'; $s .= '<label id="blogger-bydefault-label" for="blogger-bydefault">' . L10n::t('Post to Blogger by default') . '</label>';
$s .= '<input id="blogger-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="blogger-bydefault" type="checkbox" name="bl_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blogger-submit" name="blogger-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blogger-submit" name="blogger-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
@ -181,7 +182,7 @@ function blogger_send(&$a, &$b)
if ($bl_username && $bl_password && $bl_blog) { if ($bl_username && $bl_password && $bl_blog) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
$title = '<title>' . (($b['title']) ? $b['title'] : t('Post from Friendica')) . '</title>'; $title = '<title>' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '</title>';
$post = $title . bbcode($b['body']); $post = $title . bbcode($b['body']);
$post = xmlify($post); $post = xmlify($post);

View file

@ -10,6 +10,7 @@ require 'addon/buffer/bufferapp.php';
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function buffer_install() { function buffer_install() {
@ -33,7 +34,7 @@ function buffer_module() {}
function buffer_content(&$a) { function buffer_content(&$a) {
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }
@ -60,10 +61,10 @@ function buffer_addon_admin(&$a, &$o)
$t = get_markup_template("admin.tpl", "addon/buffer/"); $t = get_markup_template("admin.tpl", "addon/buffer/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$client_id' => ['client_id', t('Client ID'), Config::get('buffer', 'client_id'), ''], '$client_id' => ['client_id', L10n::t('Client ID'), Config::get('buffer', 'client_id'), ''],
'$client_secret' => ['client_secret', t('Client Secret'), Config::get('buffer', 'client_secret'), ''], '$client_secret' => ['client_secret', L10n::t('Client Secret'), Config::get('buffer', 'client_secret'), ''],
]); ]);
} }
function buffer_addon_admin_post(&$a) function buffer_addon_admin_post(&$a)
@ -72,13 +73,13 @@ function buffer_addon_admin_post(&$a)
$client_secret = ((x($_POST, 'client_secret')) ? notags(trim($_POST['client_secret'])): ''); $client_secret = ((x($_POST, 'client_secret')) ? notags(trim($_POST['client_secret'])): '');
Config::set('buffer', 'client_id', $client_id); Config::set('buffer', 'client_id', $client_id);
Config::set('buffer', 'client_secret', $client_secret); Config::set('buffer', 'client_secret', $client_secret);
info(t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }
function buffer_connect(&$a) { function buffer_connect(&$a) {
if (isset($_REQUEST["error"])) { if (isset($_REQUEST["error"])) {
$o = t('Error when registering buffer connection:')." ".$_REQUEST["error"]; $o = L10n::t('Error when registering buffer connection:')." ".$_REQUEST["error"];
return $o; return $o;
} }
// Start a session. This is necessary to hold on to a few keys the callback script will also need // Start a session. This is necessary to hold on to a few keys the callback script will also need
@ -97,8 +98,8 @@ function buffer_connect(&$a) {
$o .= '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>'; $o .= '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
} else { } else {
logger("buffer_connect: authenticated"); logger("buffer_connect: authenticated");
$o .= t("You are now authenticated to buffer. "); $o .= L10n::t("You are now authenticated to buffer. ");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>'; $o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token); PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
} }
@ -114,7 +115,7 @@ function buffer_jot_nets(&$a,&$b) {
$buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default'); $buffer_defpost = PConfig::get(local_user(),'buffer','post_by_default');
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> '
. t('Post to Buffer') . '</div>'; . L10n::t('Post to Buffer') . '</div>';
} }
} }
@ -139,11 +140,11 @@ function buffer_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_buffer_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">'; $s .= '<span id="settings_buffer_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. L10n::t('Buffer Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_buffer_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_buffer_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_buffer_expanded\'); openClose(\'settings_buffer_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. t('Buffer Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. L10n::t('Buffer Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$client_id = Config::get("buffer", "client_id"); $client_id = Config::get("buffer", "client_id");
@ -153,21 +154,21 @@ function buffer_settings(&$a,&$s) {
$s .= '<div id="buffer-password-wrapper">'; $s .= '<div id="buffer-password-wrapper">';
if ($access_token == "") { if ($access_token == "") {
$s .= '<div id="buffer-authenticate-wrapper">'; $s .= '<div id="buffer-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/buffer/connect">'.t("Authenticate your Buffer connection").'</a>'; $s .= '<a href="'.$a->get_baseurl().'/buffer/connect">'.L10n::t("Authenticate your Buffer connection").'</a>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
} else { } else {
$s .= '<div id="buffer-enable-wrapper">'; $s .= '<div id="buffer-enable-wrapper">';
$s .= '<label id="buffer-enable-label" for="buffer-checkbox">' . t('Enable Buffer Post Addon') . '</label>'; $s .= '<label id="buffer-enable-label" for="buffer-checkbox">' . L10n::t('Enable Buffer Post Addon') . '</label>';
$s .= '<input id="buffer-checkbox" type="checkbox" name="buffer" value="1" ' . $checked . '/>'; $s .= '<input id="buffer-checkbox" type="checkbox" name="buffer" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="buffer-bydefault-wrapper">'; $s .= '<div id="buffer-bydefault-wrapper">';
$s .= '<label id="buffer-bydefault-label" for="buffer-bydefault">' . t('Post to Buffer by default') . '</label>'; $s .= '<label id="buffer-bydefault-label" for="buffer-bydefault">' . L10n::t('Post to Buffer by default') . '</label>';
$s .= '<input id="buffer-bydefault" type="checkbox" name="buffer_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="buffer-bydefault" type="checkbox" name="buffer_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="buffer-delete-wrapper">'; $s .= '<div id="buffer-delete-wrapper">';
$s .= '<label id="buffer-delete-label" for="buffer-delete">' . t('Check to delete this preset') . '</label>'; $s .= '<label id="buffer-delete-label" for="buffer-delete">' . L10n::t('Check to delete this preset') . '</label>';
$s .= '<input id="buffer-delete" type="checkbox" name="buffer_delete" value="1" />'; $s .= '<input id="buffer-delete" type="checkbox" name="buffer_delete" value="1" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -176,7 +177,7 @@ function buffer_settings(&$a,&$s) {
$profiles = $buffer->go('/profiles'); $profiles = $buffer->go('/profiles');
if (is_array($profiles)) { if (is_array($profiles)) {
$s .= '<div id="buffer-accounts-wrapper">'; $s .= '<div id="buffer-accounts-wrapper">';
$s .= t("Posts are going to all accounts that are enabled by default:"); $s .= L10n::t("Posts are going to all accounts that are enabled by default:");
$s .= "<ul>"; $s .= "<ul>";
foreach ($profiles as $profile) { foreach ($profiles as $profile) {
if (!$profile->default) if (!$profile->default)
@ -196,7 +197,7 @@ function buffer_settings(&$a,&$s) {
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="buffer-submit" name="buffer-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="buffer-submit" name="buffer-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -6,10 +6,19 @@
* Author: Mike Macgirvin <mike@macgirvin.com> * Author: Mike Macgirvin <mike@macgirvin.com>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function buglink_install() { Addon::registerHook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } function buglink_install()
{
Addon::registerHook('page_end', 'addon/buglink/buglink.php', 'buglink_active');
}
function buglink_uninstall()
{
Addon::unregisterHook('page_end', 'addon/buglink/buglink.php', 'buglink_active');
}
function buglink_uninstall() { Addon::unregisterHook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } function buglink_active(&$a, &$b)
{
function buglink_active(&$a,&$b) { $b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" title="' . t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . t('Report Bug') . '" /></a></div>'; } $b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" title="' . L10n::t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . L10n::t('Report Bug') . '" /></a></div>';
}

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Module\Login; use Friendica\Module\Login;
require_once('mod/community.php'); require_once('mod/community.php');
@ -24,12 +25,12 @@ function communityhome_uninstall() {
function communityhome_getopts() { function communityhome_getopts() {
return [ return [
'hidelogin'=>t('Hide login form'), 'hidelogin'=>L10n::t('Hide login form'),
'showlastusers'=>t('Show last new users'), 'showlastusers'=>L10n::t('Show last new users'),
'showactiveusers'=>t('Show last active users'), 'showactiveusers'=>L10n::t('Show last active users'),
'showlastphotos'=>t('Show last photos'), 'showlastphotos'=>L10n::t('Show last photos'),
'showlastlike'=>t('Show last liked items'), 'showlastlike'=>L10n::t('Show last liked items'),
'showcommunitystream'=>t('Show community stream') 'showcommunitystream'=>L10n::t('Show community stream')
]; ];
} }
@ -39,7 +40,7 @@ function communityhome_addon_admin(&$a, &$o)
$opts = communityhome_getopts(); $opts = communityhome_getopts();
$ctx = [ $ctx = [
'$submit' => t("Submit"), '$submit' => L10n::t("Submit"),
'$fields' => [], '$fields' => [],
]; ];
@ -66,25 +67,25 @@ function communityhome_home(&$a, &$o){
if (!Config::get('communityhome','hidelogin')){ if (!Config::get('communityhome','hidelogin')){
$aside = [ $aside = [
'$tab_1' => t('Login'), '$tab_1' => L10n::t('Login'),
'$tab_2' => t('OpenID'), '$tab_2' => L10n::t('OpenID'),
'$noOid' => Config::get('system','no_openid'), '$noOid' => Config::get('system','no_openid'),
]; ];
// login form // login form
$aside['$login_title'] = t('Login'); $aside['$login_title'] = L10n::t('Login');
$aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true); $aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
} else { } else {
$aside = [ $aside = [
//'$tab_1' => t('Login'), //'$tab_1' => L10n::t('Login'),
//'$tab_2' => t('OpenID'), //'$tab_2' => L10n::t('OpenID'),
//'$noOid' => Config::get('system','no_openid'), //'$noOid' => Config::get('system','no_openid'),
]; ];
} }
// last 12 users // last 12 users
if (Config::get('communityhome','showlastusers')){ if (Config::get('communityhome','showlastusers')){
$aside['$lastusers_title'] = t('Latest users'); $aside['$lastusers_title'] = L10n::t('Latest users');
$aside['$lastusers_items'] = []; $aside['$lastusers_items'] = [];
$sql_extra = ""; $sql_extra = "";
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " ); $publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
@ -129,7 +130,7 @@ function communityhome_home(&$a, &$o){
ORDER BY `items` DESC,`contacts` DESC ORDER BY `items` DESC,`contacts` DESC
LIMIT 0,10"); LIMIT 0,10");
if($r && count($r)) { if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users'); $aside['$activeusers_title'] = L10n::t('Most active users');
$aside['$activeusers_items'] = []; $aside['$activeusers_items'] = [];
$photo = 'thumb'; $photo = 'thumb';
@ -147,7 +148,7 @@ function communityhome_home(&$a, &$o){
} }
// last 12 photos // last 12 photos
if (Config::get('communityhome','showlastphotos')){ if (Config::get('communityhome','showlastphotos')){
$aside['$photos_title'] = t('Latest photos'); $aside['$photos_title'] = L10n::t('Latest photos');
$aside['$photos_items'] = []; $aside['$photos_items'] = [];
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
@ -160,8 +161,8 @@ function communityhome_home(&$a, &$o){
AND `user`.`hidewall` = 0 AND `user`.`hidewall` = 0
ORDER BY `photo`.`edited` DESC ORDER BY `photo`.`edited` DESC
LIMIT 0, 12", LIMIT 0, 12",
dbesc(t('Contact Photos')), dbesc(L10n::t('Contact Photos')),
dbesc(t('Profile Photos')) dbesc(L10n::t('Profile Photos'))
); );
@ -187,7 +188,7 @@ function communityhome_home(&$a, &$o){
// last 10 liked items // last 10 liked items
if (Config::get('communityhome','showlastlike')){ if (Config::get('communityhome','showlastlike')){
$aside['$like_title'] = t('Latest likes'); $aside['$like_title'] = L10n::t('Latest likes');
$aside['$like_items'] = []; $aside['$like_items'] = [];
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
@ -209,24 +210,24 @@ function communityhome_home(&$a, &$o){
case 'http://activitystrea.ms/schema/1.0/post': case 'http://activitystrea.ms/schema/1.0/post':
switch ($rr['object-type']){ switch ($rr['object-type']){
case 'http://activitystrea.ms/schema/1.0/event': case 'http://activitystrea.ms/schema/1.0/event':
$post_type = t('event'); $post_type = L10n::t('event');
break; break;
default: default:
$post_type = t('status'); $post_type = L10n::t('status');
} }
break; break;
default: default:
if ($rr['resource-id']){ if ($rr['resource-id']){
$post_type = t('photo'); $post_type = L10n::t('photo');
$m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m); $m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$rr['plink'] = $m[1]; $rr['plink'] = $m[1];
} else { } else {
$post_type = t('status'); $post_type = L10n::t('status');
} }
} }
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>'; $plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
$aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink); $aside['$like_items'][] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
} }
} }
@ -235,7 +236,7 @@ function communityhome_home(&$a, &$o){
$tpl = get_markup_template('communityhome.tpl', 'addon/communityhome/'); $tpl = get_markup_template('communityhome.tpl', 'addon/communityhome/');
$a->page['aside'] = replace_macros($tpl, $aside); $a->page['aside'] = replace_macros($tpl, $aside);
$o = '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>'; $o = '<h1>' . ((x($a->config,'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "" ) . '</h1>';
if(file_exists('home.html')) if(file_exists('home.html'))
$o = file_get_contents('home.html'); $o = file_get_contents('home.html');

View file

@ -9,13 +9,14 @@
* *
*/ */
require_once('include/network.php'); require_once 'include/network.php';
require_once("mod/proxy.php"); require_once 'mod/proxy.php';
require_once('include/text.php'); require_once 'include/text.php';
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
// get the weather data from OpenWeatherMap // get the weather data from OpenWeatherMap
@ -33,7 +34,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
try { try {
$res = new SimpleXMLElement(fetch_url($url)); $res = new SimpleXMLElement(fetch_url($url));
} catch (Exception $e) { } catch (Exception $e) {
info(t('Error fetching weather data.\nError was: '.$e->getMessage())); info(L10n::t('Error fetching weather data.\nError was: '.$e->getMessage()));
return false; return false;
} }
if ((string)$res->temperature['unit']==='metric') { if ((string)$res->temperature['unit']==='metric') {
@ -114,26 +115,26 @@ function curweather_network_mod_init(&$fk_app,&$b) {
if ($ok) { if ($ok) {
$t = get_markup_template("widget.tpl", "addon/curweather/" ); $t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, [ $curweather = replace_macros ($t, [
'$title' => t("Current Weather"), '$title' => L10n::t("Current Weather"),
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'), '$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'], '$city' => $res['city'],
'$lon' => $res['lon'], '$lon' => $res['lon'],
'$lat' => $res['lat'], '$lat' => $res['lat'],
'$description' => $res['descripion'], '$description' => $res['descripion'],
'$temp' => $res['temperature'], '$temp' => $res['temperature'],
'$relhumidity' => ['caption'=>t('Relative Humidity'), 'val'=>$res['humidity']], '$relhumidity' => ['caption'=>L10n::t('Relative Humidity'), 'val'=>$res['humidity']],
'$pressure' => ['caption'=>t('Pressure'), 'val'=>$res['pressure']], '$pressure' => ['caption'=>L10n::t('Pressure'), 'val'=>$res['pressure']],
'$wind' => ['caption'=>t('Wind'), 'val'=> $res['wind']], '$wind' => ['caption'=>L10n::t('Wind'), 'val'=> $res['wind']],
'$lastupdate' => t('Last Updated').': '.$res['update'].'UTC', '$lastupdate' => L10n::t('Last Updated').': '.$res['update'].'UTC',
'$databy' => t('Data by'), '$databy' => L10n::t('Data by'),
'$showonmap' => t('Show on map') '$showonmap' => L10n::t('Show on map')
]); ]);
} else { } else {
$t = get_markup_template('widget-error.tpl', 'addon/curweather/'); $t = get_markup_template('widget-error.tpl', 'addon/curweather/');
$curweather = replace_macros( $t, [ $curweather = replace_macros( $t, [
'$problem' => t('There was a problem accessing the weather data. But have a look'), '$problem' => L10n::t('There was a problem accessing the weather data. But have a look'),
'$rpt' => $rpt, '$rpt' => $rpt,
'$atOWM' => t('at OpenWeatherMap') '$atOWM' => L10n::t('at OpenWeatherMap')
]); ]);
} }
@ -149,7 +150,7 @@ function curweather_addon_settings_post($a,$post) {
PConfig::set(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable'])); PConfig::set(local_user(),'curweather','curweather_enable',intval($_POST['curweather_enable']));
PConfig::set(local_user(),'curweather','curweather_units',trim($_POST['curweather_units'])); PConfig::set(local_user(),'curweather','curweather_units',trim($_POST['curweather_units']));
info( t('Current Weather settings updated.') . EOL); info(L10n::t('Current Weather settings updated.') . EOL);
} }
@ -164,7 +165,7 @@ function curweather_addon_settings(&$a,&$s) {
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units'); $curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid'); $appid = Config::get('curweather','appid');
if ($appid=="") { if ($appid=="") {
$noappidtext = t('No APPID found, please contact your admin to obtain one.'); $noappidtext = L10n::t('No APPID found, please contact your admin to obtain one.');
} else { } else {
$noappidtext = ''; $noappidtext = '';
} }
@ -174,13 +175,13 @@ function curweather_addon_settings(&$a,&$s) {
// load template and replace the macros // load template and replace the macros
$t = get_markup_template("settings.tpl", "addon/curweather/" ); $t = get_markup_template("settings.tpl", "addon/curweather/" );
$s = replace_macros ($t, [ $s = replace_macros ($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$header' => t('Current Weather').' '.t('Settings'), '$header' => L10n::t('Current Weather').' '.L10n::t('Settings'),
'$noappidtext' => $noappidtext, '$noappidtext' => $noappidtext,
'$info' => t('Enter either the name of your location or the zip code.'), '$info' => L10n::t('Enter either the name of your location or the zip code.'),
'$curweather_loc' => [ 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ], '$curweather_loc' => [ 'curweather_loc', L10n::t('Your Location'), $curweather_loc, L10n::t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ],
'$curweather_units' => [ 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in &deg;C or &deg;F'), ['metric'=>'°C', 'imperial'=>'°F']], '$curweather_units' => [ 'curweather_units', L10n::t('Units'), $curweather_units, L10n::t('select if the temperature should be displayed in &deg;C or &deg;F'), ['metric'=>'°C', 'imperial'=>'°F']],
'$enabled' => [ 'curweather_enable', t('Show weather data'), $enable, ''] '$enabled' => [ 'curweather_enable', L10n::t('Show weather data'), $enable, '']
]); ]);
return; return;
@ -193,7 +194,7 @@ function curweather_addon_admin_post (&$a) {
if ($_POST['curweather-submit']) { if ($_POST['curweather-submit']) {
Config::set('curweather','appid',trim($_POST['appid'])); Config::set('curweather','appid',trim($_POST['appid']));
Config::set('curweather','cachetime',trim($_POST['cachetime'])); Config::set('curweather','cachetime',trim($_POST['cachetime']));
info( t('Curweather settings saved.'.EOL)); info(L10n::t('Curweather settings saved.'.EOL));
} }
} }
function curweather_addon_admin (&$a, &$o) { function curweather_addon_admin (&$a, &$o) {
@ -203,8 +204,8 @@ function curweather_addon_admin (&$a, &$o) {
$cachetime = Config::get('curweather','cachetime'); $cachetime = Config::get('curweather','cachetime');
$t = get_markup_template("admin.tpl", "addon/curweather/" ); $t = get_markup_template("admin.tpl", "addon/curweather/" );
$o = replace_macros ($t, [ $o = replace_macros ($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$cachetime' => ['cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes')]], '$cachetime' => ['cachetime', L10n::t('Caching Interval'), $cachetime, L10n::t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>L10n::t('no cache'), '300'=>'5 '.L10n::t('minutes'), '900'=>'15 '.L10n::t('minutes'), '1800'=>'30 '.L10n::t('minutes'), '3600'=>'60 '.L10n::t('minutes')]],
'$appid' => ['appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap')] '$appid' => ['appid', L10n::t('Your APPID'), $appid, L10n::t('Your API key provided by OpenWeatherMap')]
]); ]);
} }

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common
{ {
@ -36,7 +38,7 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common
*/ */
public static function getBackendTypeName() public static function getBackendTypeName()
{ {
return t("Private Events"); return L10n::t("Private Events");
} }
/** /**

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
class Sabre_CardDAV_Backend_Std extends Sabre_CardDAV_Backend_Common class Sabre_CardDAV_Backend_Std extends Sabre_CardDAV_Backend_Common
{ {
@ -43,7 +45,7 @@ class Sabre_CardDAV_Backend_Std extends Sabre_CardDAV_Backend_Common
*/ */
public static function getBackendTypeName() public static function getBackendTypeName()
{ {
return t("Private Addressbooks"); return L10n::t("Private Addressbooks");
} }
/** /**

View file

@ -1,7 +1,6 @@
<?php <?php
use Friendica\Core\L10n;
/** /**
* @param mixed $obj * @param mixed $obj
@ -89,7 +88,7 @@ function wdcal_print_feed($base_path = "")
$cs = wdcal_print_feed_getCal($server, DAV_ACL_WRITE); $cs = wdcal_print_feed_getCal($server, DAV_ACL_WRITE);
if ($cs == null) { if ($cs == null) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }
try { try {
@ -163,7 +162,7 @@ function wdcal_print_feed($base_path = "")
$r = q("SELECT `calendarobject_id`, `calendar_id` FROM %s%sjqcalendar WHERE `id`=%d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["jq_id"])); $r = q("SELECT `calendarobject_id`, `calendar_id` FROM %s%sjqcalendar WHERE `id`=%d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["jq_id"]));
if (count($r) != 1) { if (count($r) != 1) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }
try { try {
@ -175,7 +174,7 @@ function wdcal_print_feed($base_path = "")
if (!$component) { if (!$component) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }
@ -203,7 +202,7 @@ function wdcal_print_feed($base_path = "")
); );
} catch (Exception $e) { } catch (Exception $e) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }
break; break;
@ -211,7 +210,7 @@ function wdcal_print_feed($base_path = "")
$r = q("SELECT `calendarobject_id`, `calendar_id` FROM %s%sjqcalendar WHERE `id`=%d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["jq_id"])); $r = q("SELECT `calendarobject_id`, `calendar_id` FROM %s%sjqcalendar WHERE `id`=%d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["jq_id"]));
if (count($r) != 1) { if (count($r) != 1) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }
try { try {
@ -226,7 +225,7 @@ function wdcal_print_feed($base_path = "")
); );
} catch (Exception $e) { } catch (Exception $e) {
echo wdcal_jsonp_encode(array('IsSuccess' => false, echo wdcal_jsonp_encode(array('IsSuccess' => false,
'Msg' => t('No access'))); 'Msg' => L10n::t('No access')));
killme(); killme();
} }

View file

@ -1,5 +1,6 @@
<?php <?php
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
abstract class wdcal_local abstract class wdcal_local
@ -147,7 +148,7 @@ class wdcal_local_us extends wdcal_local {
* @return string * @return string
*/ */
static function getName() { static function getName() {
return t("U.S. Time Format (mm/dd/YYYY)"); return L10n::t("U.S. Time Format (mm/dd/YYYY)");
} }
/** /**
@ -242,7 +243,7 @@ class wdcal_local_de extends wdcal_local {
* @return string * @return string
*/ */
static function getName() { static function getName() {
return t("German Time Format (dd.mm.YYYY)"); return L10n::t("German Time Format (dd.mm.YYYY)");
} }
/** /**

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
/** /**
* @param wdcal_local $localization * @param wdcal_local $localization
* @param string $baseurl * @param string $baseurl
@ -27,7 +29,7 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$vObject = dav_get_current_user_calendarobject($server, $calendar, $obj_uri["uri"], DAV_ACL_WRITE); $vObject = dav_get_current_user_calendarobject($server, $calendar, $obj_uri["uri"], DAV_ACL_WRITE);
$component = dav_get_eventComponent($vObject); $component = dav_get_eventComponent($vObject);
if ($component == null) return t('Could not open component for editing'); if ($component == null) return L10n::t('Could not open component for editing');
/** @var Sabre\VObject\Property\DateTime $dtstart */ /** @var Sabre\VObject\Property\DateTime $dtstart */
$dtstart = $component->__get("DTSTART"); $dtstart = $component->__get("DTSTART");
@ -137,13 +139,13 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$postto = $baseurl . "/dav/wdcal/" . ($uri == 0 ? "new/" : $calendar_id . "/" . $uri . "/edit/"); $postto = $baseurl . "/dav/wdcal/" . ($uri == 0 ? "new/" : $calendar_id . "/" . $uri . "/edit/");
$out = "<a href='" . $baseurl . "/dav/wdcal/'>" . t("Go back to the calendar") . "</a><br><br>"; $out = "<a href='" . $baseurl . "/dav/wdcal/'>" . L10n::t("Go back to the calendar") . "</a><br><br>";
$out .= "<form method='POST' action='$postto'> $out .= "<form method='POST' action='$postto'>
<input type='hidden' name='form_security_token' value='" . get_form_security_token('caledit') . "'>\n"; <input type='hidden' name='form_security_token' value='" . get_form_security_token('caledit') . "'>\n";
$out .= "<h2>" . t("Event data") . "</h2>"; $out .= "<h2>" . L10n::t("Event data") . "</h2>";
$out .= "<label for='calendar' class='block'>" . t("Calendar") . ":</label><select id='calendar' name='calendar' size='1'>"; $out .= "<label for='calendar' class='block'>" . L10n::t("Calendar") . ":</label><select id='calendar' name='calendar' size='1'>";
$found = false; $found = false;
$cal_col = "aaaaaa"; $cal_col = "aaaaaa";
foreach ($calendars as $cal) { foreach ($calendars as $cal) {
@ -160,47 +162,47 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$out .= "</select>"; $out .= "</select>";
$out .= "&nbsp; &nbsp; <label class='plain'><input type='checkbox' name='color_override' id='color_override' "; $out .= "&nbsp; &nbsp; <label class='plain'><input type='checkbox' name='color_override' id='color_override' ";
if (!is_null($event["Color"])) $out .= "checked"; if (!is_null($event["Color"])) $out .= "checked";
$out .= "> " . t("Special color") . ":</label>"; $out .= "> " . L10n::t("Special color") . ":</label>";
$out .= "<span id='cal_color_holder' "; $out .= "<span id='cal_color_holder' ";
if (is_null($event["Color"])) $out .= "style='display: none;'"; if (is_null($event["Color"])) $out .= "style='display: none;'";
$out .= "><input name='color' id='cal_color' value='" . (is_null($event["Color"]) ? "#" . $cal_col : escape_tags($event["Color"])) . "'></span>"; $out .= "><input name='color' id='cal_color' value='" . (is_null($event["Color"]) ? "#" . $cal_col : escape_tags($event["Color"])) . "'></span>";
$out .= "<br>\n"; $out .= "<br>\n";
$out .= "<label class='block' for='cal_summary'>" . t("Subject") . ":</label> $out .= "<label class='block' for='cal_summary'>" . L10n::t("Subject") . ":</label>
<input name='summary' id='cal_summary' value=\"" . escape_tags($event["Summary"]) . "\"><br>\n"; <input name='summary' id='cal_summary' value=\"" . escape_tags($event["Summary"]) . "\"><br>\n";
$out .= "<label class='block' for='cal_allday'>Is All-Day event:</label><input type='checkbox' name='allday' id='cal_allday' " . ($event["IsAllDayEvent"] ? "checked" : "") . "><br>\n"; $out .= "<label class='block' for='cal_allday'>Is All-Day event:</label><input type='checkbox' name='allday' id='cal_allday' " . ($event["IsAllDayEvent"] ? "checked" : "") . "><br>\n";
$out .= "<label class='block' for='cal_start_date'>" . t("Starts") . ":</label>"; $out .= "<label class='block' for='cal_start_date'>" . L10n::t("Starts") . ":</label>";
$out .= "<input name='start_date' value='" . $localization->dateformat_datepicker_php($event["StartTime"]) . "' id='cal_start_date'>"; $out .= "<input name='start_date' value='" . $localization->dateformat_datepicker_php($event["StartTime"]) . "' id='cal_start_date'>";
$out .= "<input name='start_time' value='" . date("H:i", $event["StartTime"]) . "' id='cal_start_time'>"; $out .= "<input name='start_time' value='" . date("H:i", $event["StartTime"]) . "' id='cal_start_time'>";
$out .= "<br>\n"; $out .= "<br>\n";
$out .= "<label class='block' for='cal_end_date'>" . t("Ends") . ":</label>"; $out .= "<label class='block' for='cal_end_date'>" . L10n::t("Ends") . ":</label>";
$out .= "<input name='end_date' value='" . $localization->dateformat_datepicker_php($event["EndTime"]) . "' id='cal_end_date'>"; $out .= "<input name='end_date' value='" . $localization->dateformat_datepicker_php($event["EndTime"]) . "' id='cal_end_date'>";
$out .= "<input name='end_time' value='" . date("H:i", $event["EndTime"]) . "' id='cal_end_time'>"; $out .= "<input name='end_time' value='" . date("H:i", $event["EndTime"]) . "' id='cal_end_time'>";
$out .= "<br>\n"; $out .= "<br>\n";
$out .= "<label class='block' for='cal_location'>" . t("Location") . ":</label><input name='location' id='cal_location' value=\"" . escape_tags($event["Location"]) . "\"><br>\n"; $out .= "<label class='block' for='cal_location'>" . L10n::t("Location") . ":</label><input name='location' id='cal_location' value=\"" . escape_tags($event["Location"]) . "\"><br>\n";
$out .= "<label class='block' for='event-desc-textarea'>" . t("Description") . ":</label> <textarea id='event-desc-textarea' name='wdcal_desc' style='vertical-align: top; width: 400px; height: 100px;'>" . escape_tags($event["Description"]) . "</textarea>"; $out .= "<label class='block' for='event-desc-textarea'>" . L10n::t("Description") . ":</label> <textarea id='event-desc-textarea' name='wdcal_desc' style='vertical-align: top; width: 400px; height: 100px;'>" . escape_tags($event["Description"]) . "</textarea>";
$out .= "<br style='clear: both;'>"; $out .= "<br style='clear: both;'>";
$out .= "<h2>" . t("Recurrence") . "</h2>"; $out .= "<h2>" . L10n::t("Recurrence") . "</h2>";
$out .= "<label class='block' for='rec_frequency'>" . t("Frequency") . ":</label> <select id='rec_frequency' name='rec_frequency' size='1'>"; $out .= "<label class='block' for='rec_frequency'>" . L10n::t("Frequency") . ":</label> <select id='rec_frequency' name='rec_frequency' size='1'>";
$out .= "<option value=''>" . t("None") . "</option>\n"; $out .= "<option value=''>" . L10n::t("None") . "</option>\n";
$out .= "<option value='daily' "; $out .= "<option value='daily' ";
if ($recurrence && $recurrence->frequency == "daily") $out .= "selected"; if ($recurrence && $recurrence->frequency == "daily") $out .= "selected";
$out .= ">" . t("Daily") . "</option>\n"; $out .= ">" . L10n::t("Daily") . "</option>\n";
$out .= "<option value='weekly' "; $out .= "<option value='weekly' ";
if ($recurrence && $recurrence->frequency == "weekly") $out .= "selected"; if ($recurrence && $recurrence->frequency == "weekly") $out .= "selected";
$out .= ">" . t("Weekly") . "</option>\n"; $out .= ">" . L10n::t("Weekly") . "</option>\n";
$out .= "<option value='monthly' "; $out .= "<option value='monthly' ";
if ($recurrence && $recurrence->frequency == "monthly") $out .= "selected"; if ($recurrence && $recurrence->frequency == "monthly") $out .= "selected";
$out .= ">" . t("Monthly") . "</option>\n"; $out .= ">" . L10n::t("Monthly") . "</option>\n";
$out .= "<option value='yearly' "; $out .= "<option value='yearly' ";
if ($recurrence && $recurrence->frequency == "yearly") $out .= "selected"; if ($recurrence && $recurrence->frequency == "yearly") $out .= "selected";
$out .= ">" . t("Yearly") . "</option>\n"; $out .= ">" . L10n::t("Yearly") . "</option>\n";
$out .= "</select><br>\n"; $out .= "</select><br>\n";
$out .= "<div id='rec_details'>"; $out .= "<div id='rec_details'>";
@ -211,15 +213,15 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$select .= ">$i</option>\n"; $select .= ">$i</option>\n";
} }
$select .= "</select>"; $select .= "</select>";
$time = "<span class='rec_daily'>" . t("days") . "</span>"; $time = "<span class='rec_daily'>" . L10n::t("days") . "</span>";
$time .= "<span class='rec_weekly'>" . t("weeks") . "</span>"; $time .= "<span class='rec_weekly'>" . L10n::t("weeks") . "</span>";
$time .= "<span class='rec_monthly'>" . t("months") . "</span>"; $time .= "<span class='rec_monthly'>" . L10n::t("months") . "</span>";
$time .= "<span class='rec_yearly'>" . t("years") . "</span>"; $time .= "<span class='rec_yearly'>" . L10n::t("years") . "</span>";
$out .= "<label class='block'>" . t("Interval") . ":</label> " . str_replace(array("%select%", "%time%"), array($select, $time), t("All %select% %time%")) . "<br>"; $out .= "<label class='block'>" . L10n::t("Interval") . ":</label> " . str_replace(array("%select%", "%time%"), array($select, $time), L10n::t("All %select% %time%")) . "<br>";
$out .= "<div class='rec_daily'>"; $out .= "<div class='rec_daily'>";
$out .= "<label class='block'>" . t("Days") . ":</label>"; $out .= "<label class='block'>" . L10n::t("Days") . ":</label>";
if ($recurrence && $recurrence->byDay) { if ($recurrence && $recurrence->byDay) {
$byday = $recurrence->byDay; $byday = $recurrence->byDay;
} else { } else {
@ -228,36 +230,36 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
if ($localization->getFirstDayOfWeek() == 0) { if ($localization->getFirstDayOfWeek() == 0) {
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SU' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SU' ";
if (in_array("SU", $byday)) $out .= "checked"; if (in_array("SU", $byday)) $out .= "checked";
$out .= ">" . t("Sunday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Sunday") . "</label> &nbsp; ";
} }
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='MO' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='MO' ";
if (in_array("MO", $byday)) $out .= "checked"; if (in_array("MO", $byday)) $out .= "checked";
$out .= ">" . t("Monday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Monday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='TU' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='TU' ";
if (in_array("TU", $byday)) $out .= "checked"; if (in_array("TU", $byday)) $out .= "checked";
$out .= ">" . t("Tuesday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Tuesday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='WE' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='WE' ";
if (in_array("WE", $byday)) $out .= "checked"; if (in_array("WE", $byday)) $out .= "checked";
$out .= ">" . t("Wednesday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Wednesday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='TH' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='TH' ";
if (in_array("TH", $byday)) $out .= "checked"; if (in_array("TH", $byday)) $out .= "checked";
$out .= ">" . t("Thursday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Thursday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='FR' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='FR' ";
if (in_array("FR", $byday)) $out .= "checked"; if (in_array("FR", $byday)) $out .= "checked";
$out .= ">" . t("Friday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Friday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SA' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SA' ";
if (in_array("SA", $byday)) $out .= "checked"; if (in_array("SA", $byday)) $out .= "checked";
$out .= ">" . t("Saturday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Saturday") . "</label> &nbsp; ";
if ($localization->getFirstDayOfWeek() != 0) { if ($localization->getFirstDayOfWeek() != 0) {
$out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SU' "; $out .= "<label class='plain'><input class='rec_daily_byday' type='checkbox' name='rec_daily_byday[]' value='SU' ";
if (in_array("SU", $byday)) $out .= "checked"; if (in_array("SU", $byday)) $out .= "checked";
$out .= ">" . t("Sunday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Sunday") . "</label> &nbsp; ";
} }
$out .= "</div>"; $out .= "</div>";
$out .= "<div class='rec_weekly'>"; $out .= "<div class='rec_weekly'>";
$out .= "<label class='block'>" . t("Days") . ":</label>"; $out .= "<label class='block'>" . L10n::t("Days") . ":</label>";
if ($recurrence && $recurrence->byDay) { if ($recurrence && $recurrence->byDay) {
$byday = $recurrence->byDay; $byday = $recurrence->byDay;
} else { } else {
@ -267,34 +269,34 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
if ($localization->getFirstDayOfWeek() == 0) { if ($localization->getFirstDayOfWeek() == 0) {
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SU' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SU' ";
if (in_array("SU", $byday)) $out .= "checked"; if (in_array("SU", $byday)) $out .= "checked";
$out .= ">" . t("Sunday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Sunday") . "</label> &nbsp; ";
} }
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='MO' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='MO' ";
if (in_array("MO", $byday)) $out .= "checked"; if (in_array("MO", $byday)) $out .= "checked";
$out .= ">" . t("Monday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Monday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='TU' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='TU' ";
if (in_array("TU", $byday)) $out .= "checked"; if (in_array("TU", $byday)) $out .= "checked";
$out .= ">" . t("Tuesday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Tuesday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='WE' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='WE' ";
if (in_array("WE", $byday)) $out .= "checked"; if (in_array("WE", $byday)) $out .= "checked";
$out .= ">" . t("Wednesday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Wednesday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='TH' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='TH' ";
if (in_array("TH", $byday)) $out .= "checked"; if (in_array("TH", $byday)) $out .= "checked";
$out .= ">" . t("Thursday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Thursday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='FR' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='FR' ";
if (in_array("FR", $byday)) $out .= "checked"; if (in_array("FR", $byday)) $out .= "checked";
$out .= ">" . t("Friday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Friday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SA' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SA' ";
if (in_array("SA", $byday)) $out .= "checked"; if (in_array("SA", $byday)) $out .= "checked";
$out .= ">" . t("Saturday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Saturday") . "</label> &nbsp; ";
if ($localization->getFirstDayOfWeek() != 0) { if ($localization->getFirstDayOfWeek() != 0) {
$out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SU' "; $out .= "<label class='plain'><input class='rec_weekly_byday' type='checkbox' name='rec_weekly_byday[]' value='SU' ";
if (in_array("SU", $byday)) $out .= "checked"; if (in_array("SU", $byday)) $out .= "checked";
$out .= ">" . t("Sunday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Sunday") . "</label> &nbsp; ";
} }
$out .= "<br>"; $out .= "<br>";
$out .= "<label class='block'>" . t("First day of week:") . "</label>"; $out .= "<label class='block'>" . L10n::t("First day of week:") . "</label>";
if ($recurrence && $recurrence->weekStart != "") $wkst = $recurrence->weekStart; if ($recurrence && $recurrence->weekStart != "") $wkst = $recurrence->weekStart;
else { else {
if ($localization->getFirstDayOfWeek() == 0) $wkst = "SU"; if ($localization->getFirstDayOfWeek() == 0) $wkst = "SU";
@ -302,10 +304,10 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
} }
$out .= "<label class='plain'><input type='radio' name='rec_weekly_wkst' value='SU' "; $out .= "<label class='plain'><input type='radio' name='rec_weekly_wkst' value='SU' ";
if ($wkst == "SU") $out .= "checked"; if ($wkst == "SU") $out .= "checked";
$out .= ">" . t("Sunday") . "</label> &nbsp; "; $out .= ">" . L10n::t("Sunday") . "</label> &nbsp; ";
$out .= "<label class='plain'><input type='radio' name='rec_weekly_wkst' value='MO' "; $out .= "<label class='plain'><input type='radio' name='rec_weekly_wkst' value='MO' ";
if ($wkst == "MO") $out .= "checked"; if ($wkst == "MO") $out .= "checked";
$out .= ">" . t("Monday") . "</label><br>\n"; $out .= ">" . L10n::t("Monday") . "</label><br>\n";
$out .= "</div>"; $out .= "</div>";
@ -347,20 +349,20 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
} }
$out .= "<div class='rec_monthly'>"; $out .= "<div class='rec_monthly'>";
$out .= "<label class='block' for='rec_monthly_day'>" . t("Day of month") . ":</label>"; $out .= "<label class='block' for='rec_monthly_day'>" . L10n::t("Day of month") . ":</label>";
$out .= "<select id='rec_monthly_day' name='rec_monthly_day' size='1'>"; $out .= "<select id='rec_monthly_day' name='rec_monthly_day' size='1'>";
$out .= "<option value='bymonthday' "; $out .= "<option value='bymonthday' ";
if ($monthly_rule == "bymonthday") $out .= "selected"; if ($monthly_rule == "bymonthday") $out .= "selected";
$out .= ">" . t("#num#th of each month") . "</option>\n"; $out .= ">" . L10n::t("#num#th of each month") . "</option>\n";
$out .= "<option value='bymonthday_neg' "; $out .= "<option value='bymonthday_neg' ";
if ($monthly_rule == "bymonthday_neg") $out .= "selected"; if ($monthly_rule == "bymonthday_neg") $out .= "selected";
$out .= ">" . t("#num#th-last of each month") . "</option>\n"; $out .= ">" . L10n::t("#num#th-last of each month") . "</option>\n";
$out .= "<option value='byday' "; $out .= "<option value='byday' ";
if ($monthly_rule == "byday") $out .= "selected"; if ($monthly_rule == "byday") $out .= "selected";
$out .= ">" . t("#num#th #wkday# of each month") . "</option>\n"; $out .= ">" . L10n::t("#num#th #wkday# of each month") . "</option>\n";
$out .= "<option value='byday_neg' "; $out .= "<option value='byday_neg' ";
if ($monthly_rule == "byday_neg") $out .= "selected"; if ($monthly_rule == "byday_neg") $out .= "selected";
$out .= ">" . t("#num#th-last #wkday# of each month") . "</option>\n"; $out .= ">" . L10n::t("#num#th-last #wkday# of each month") . "</option>\n";
$out .= "</select>"; $out .= "</select>";
$out .= "</div>\n"; $out .= "</div>\n";
@ -369,21 +371,21 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
} }
$out .= "<div class='rec_yearly'>"; $out .= "<div class='rec_yearly'>";
$out .= "<label class='block'>" . t("Month") . ":</label> <span class='rec_month_name'>#month#</span><br>\n"; $out .= "<label class='block'>" . L10n::t("Month") . ":</label> <span class='rec_month_name'>#month#</span><br>\n";
$out .= "<label class='block' for='rec_yearly_day'>" . t("Day of month") . ":</label>"; $out .= "<label class='block' for='rec_yearly_day'>" . L10n::t("Day of month") . ":</label>";
$out .= "<select id='rec_yearly_day' name='rec_yearly_day' size='1'>"; $out .= "<select id='rec_yearly_day' name='rec_yearly_day' size='1'>";
$out .= "<option value='bymonthday' "; $out .= "<option value='bymonthday' ";
if ($monthly_rule == "bymonthday") $out .= "selected"; if ($monthly_rule == "bymonthday") $out .= "selected";
$out .= ">" . t("#num#th of the given month") . "</option>\n"; $out .= ">" . L10n::t("#num#th of the given month") . "</option>\n";
$out .= "<option value='bymonthday_neg' "; $out .= "<option value='bymonthday_neg' ";
if ($monthly_rule == "bymonthday_neg") $out .= "selected"; if ($monthly_rule == "bymonthday_neg") $out .= "selected";
$out .= ">" . t("#num#th-last of the given month") . "</option>\n"; $out .= ">" . L10n::t("#num#th-last of the given month") . "</option>\n";
$out .= "<option value='byday' "; $out .= "<option value='byday' ";
if ($monthly_rule == "byday") $out .= "selected"; if ($monthly_rule == "byday") $out .= "selected";
$out .= ">" . t("#num#th #wkday# of the given month") . "</option>\n"; $out .= ">" . L10n::t("#num#th #wkday# of the given month") . "</option>\n";
$out .= "<option value='byday_neg' "; $out .= "<option value='byday_neg' ";
if ($monthly_rule == "byday_neg") $out .= "selected"; if ($monthly_rule == "byday_neg") $out .= "selected";
$out .= ">" . t("#num#th-last #wkday# of the given month") . "</option>\n"; $out .= ">" . L10n::t("#num#th-last #wkday# of the given month") . "</option>\n";
$out .= "</select>"; $out .= "</select>";
$out .= "</div>\n"; $out .= "</div>\n";
@ -410,26 +412,26 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$rule_until_date = time(); $rule_until_date = time();
$rule_until_count = 1; $rule_until_count = 1;
} }
$out .= "<label class='block' for='rec_until_type'>" . t("Repeat until") . ":</label> "; $out .= "<label class='block' for='rec_until_type'>" . L10n::t("Repeat until") . ":</label> ";
$out .= "<select name='rec_until_type' id='rec_until_type' size='1'>"; $out .= "<select name='rec_until_type' id='rec_until_type' size='1'>";
$out .= "<option value='infinite' "; $out .= "<option value='infinite' ";
if ($rule_type == "infinite") $out .= "selected"; if ($rule_type == "infinite") $out .= "selected";
$out .= ">" . t("Infinite") . "</option>\n"; $out .= ">" . L10n::t("Infinite") . "</option>\n";
$out .= "<option value='date' "; $out .= "<option value='date' ";
if ($rule_type == "date") $out .= "selected"; if ($rule_type == "date") $out .= "selected";
$out .= ">" . t("Until the following date") . ":</option>\n"; $out .= ">" . L10n::t("Until the following date") . ":</option>\n";
$out .= "<option value='count' "; $out .= "<option value='count' ";
if ($rule_type == "count") $out .= "selected"; if ($rule_type == "count") $out .= "selected";
$out .= ">" . t("Number of times") . ":</option>\n"; $out .= ">" . L10n::t("Number of times") . ":</option>\n";
$out .= "</select>"; $out .= "</select>";
$out .= "<input name='rec_until_date' value='" . $localization->dateformat_datepicker_php($rule_until_date) . "' id='rec_until_date'>"; $out .= "<input name='rec_until_date' value='" . $localization->dateformat_datepicker_php($rule_until_date) . "' id='rec_until_date'>";
$out .= "<input name='rec_until_count' value='$rule_until_count' id='rec_until_count'><br>"; $out .= "<input name='rec_until_count' value='$rule_until_count' id='rec_until_count'><br>";
$out .= "<label class='block'>" . t("Exceptions") . ":</label><div class='rec_exceptions'>"; $out .= "<label class='block'>" . L10n::t("Exceptions") . ":</label><div class='rec_exceptions'>";
$out .= "<div class='rec_exceptions_none' "; $out .= "<div class='rec_exceptions_none' ";
if (count($recurrentce_exdates) > 0) $out .= "style='display: none;'"; if (count($recurrentce_exdates) > 0) $out .= "style='display: none;'";
$out .= ">" . t("none") . "</div>"; $out .= ">" . L10n::t("none") . "</div>";
$out .= "<div class='rec_exceptions_holder' "; $out .= "<div class='rec_exceptions_holder' ";
if (count($recurrentce_exdates) == 0) $out .= "style='display: none;'"; if (count($recurrentce_exdates) == 0) $out .= "style='display: none;'";
$out .= ">"; $out .= ">";
@ -446,7 +448,7 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$out .= "</div><br>"; $out .= "</div><br>";
$out .= "<h2>" . t("Notification") . "</h2>"; $out .= "<h2>" . L10n::t("Notification") . "</h2>";
if (!$notifications) $notifications = array(); if (!$notifications) $notifications = array();
$notifications["new"] = array( $notifications["new"] = array(
@ -463,33 +465,33 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $calendar_id, $uri)
$out .= "<div class='noti_holder' "; $out .= "<div class='noti_holder' ";
if (!is_numeric($index) && $index == "new") $out .= "style='display: none;' id='noti_new_row'"; if (!is_numeric($index) && $index == "new") $out .= "style='display: none;' id='noti_new_row'";
$out .= "><label class='block' for='noti_type_" . $index . "'>" . t("Notify by") . ":</label>"; $out .= "><label class='block' for='noti_type_" . $index . "'>" . L10n::t("Notify by") . ":</label>";
$out .= "<select name='noti_type[$index]' size='1' id='noti_type_" . $index . "'>"; $out .= "<select name='noti_type[$index]' size='1' id='noti_type_" . $index . "'>";
$out .= "<option value=''>- " . t("Remove") . " -</option>\n"; $out .= "<option value=''>- " . L10n::t("Remove") . " -</option>\n";
$out .= "<option value='email' "; if (!$unparsable && $noti["action"] == "email") $out .= "selected"; $out .= ">" . t("E-Mail") . "</option>\n"; $out .= "<option value='email' "; if (!$unparsable && $noti["action"] == "email") $out .= "selected"; $out .= ">" . L10n::t("E-Mail") . "</option>\n";
$out .= "<option value='display' "; if (!$unparsable && $noti["action"] == "display") $out .= "selected"; $out .= ">" . t("On Friendica / Display") . "</option>\n"; $out .= "<option value='display' "; if (!$unparsable && $noti["action"] == "display") $out .= "selected"; $out .= ">" . L10n::t("On Friendica / Display") . "</option>\n";
//$out .= "<option value='other' "; if ($unparsable) $out .= "selected"; $out .= ">- " . t("other (leave it untouched)") . " -</option>\n"; // @TODO //$out .= "<option value='other' "; if ($unparsable) $out .= "selected"; $out .= ">- " . L10n::t("other (leave it untouched)") . " -</option>\n"; // @TODO
$out .= "</select><br>"; $out .= "</select><br>";
$out .= "<label class='block'>" . t("Time") . ":</label>"; $out .= "<label class='block'>" . L10n::t("Time") . ":</label>";
$out .= "<input name='noti_value[$index]' size='5' style='width: 5em;' value='" . $noti["trigger_value"] . "'>"; $out .= "<input name='noti_value[$index]' size='5' style='width: 5em;' value='" . $noti["trigger_value"] . "'>";
$out .= "<select name='noti_unit[$index]' size='1'>"; $out .= "<select name='noti_unit[$index]' size='1'>";
$out .= "<option value='H' "; if ($noti["trigger_unit"] == "hour") $out .= "selected"; $out .= ">" . t("Hours") . "</option>\n"; $out .= "<option value='H' "; if ($noti["trigger_unit"] == "hour") $out .= "selected"; $out .= ">" . L10n::t("Hours") . "</option>\n";
$out .= "<option value='M' "; if ($noti["trigger_unit"] == "minute") $out .= "selected"; $out .= ">" . t("Minutes") . "</option>\n"; $out .= "<option value='M' "; if ($noti["trigger_unit"] == "minute") $out .= "selected"; $out .= ">" . L10n::t("Minutes") . "</option>\n";
$out .= "<option value='S' "; if ($noti["trigger_unit"] == "second") $out .= "selected"; $out .= ">" . t("Seconds") . "</option>\n"; $out .= "<option value='S' "; if ($noti["trigger_unit"] == "second") $out .= "selected"; $out .= ">" . L10n::t("Seconds") . "</option>\n";
$out .= "<option value='D' "; if ($noti["trigger_unit"] == "day") $out .= "selected"; $out .= ">" . t("Days") . "</option>\n"; $out .= "<option value='D' "; if ($noti["trigger_unit"] == "day") $out .= "selected"; $out .= ">" . L10n::t("Days") . "</option>\n";
$out .= "<option value='W' "; if ($noti["trigger_unit"] == "week") $out .= "selected"; $out .= ">" . t("Weeks") . "</option>\n"; $out .= "<option value='W' "; if ($noti["trigger_unit"] == "week") $out .= "selected"; $out .= ">" . L10n::t("Weeks") . "</option>\n";
$out .= "</select>"; $out .= "</select>";
$out .= " <label class='plain'>" . t("before the") . " <select name='noti_ref[$index]' size='1'>"; $out .= " <label class='plain'>" . L10n::t("before the") . " <select name='noti_ref[$index]' size='1'>";
$out .= "<option value='start' "; if ($noti["rel"] == "start") $out .= "selected"; $out .= ">" . t("start of the event") . "</option>\n"; $out .= "<option value='start' "; if ($noti["rel"] == "start") $out .= "selected"; $out .= ">" . L10n::t("start of the event") . "</option>\n";
$out .= "<option value='end' "; if ($noti["rel"] == "end") $out .= "selected"; $out .= ">" . t("end of the event") . "</option>\n"; $out .= "<option value='end' "; if ($noti["rel"] == "end") $out .= "selected"; $out .= ">" . L10n::t("end of the event") . "</option>\n";
$out .= "</select></label>\n"; $out .= "</select></label>\n";
$out .= "</div>"; $out .= "</div>";
} }
$out .= "<input type='hidden' name='new_alarm' id='new_alarm' value='0'><div id='new_alarm_adder'><a href='#'>" . t("Add a notification") . "</a></div>"; $out .= "<input type='hidden' name='new_alarm' id='new_alarm' value='0'><div id='new_alarm_adder'><a href='#'>" . L10n::t("Add a notification") . "</a></div>";
$out .= "<script>\$(function() { $out .= "<script>\$(function() {
wdcal_edit_init('" . $localization->dateformat_datepicker_js() . "', '${baseurl}/dav/'); wdcal_edit_init('" . $localization->dateformat_datepicker_js() . "', '${baseurl}/dav/');
@ -684,7 +686,7 @@ function wdcal_set_component_alerts(&$component, &$localization, $summary, $dtst
"#date#", "#name", "#date#", "#name",
), array( ), array(
$localization->date_timestamp2local($dtstart), $summary, $localization->date_timestamp2local($dtstart), $summary,
), t("The event #name# will start at #date")); ), L10n::t("The event #name# will start at #date"));
$alarm->add(new Sabre\VObject\Property("ACTION", "EMAIL")); $alarm->add(new Sabre\VObject\Property("ACTION", "EMAIL"));
$alarm->add(new Sabre\VObject\Property("SUMMARY", $summary)); $alarm->add(new Sabre\VObject\Property("SUMMARY", $summary));
@ -693,7 +695,7 @@ function wdcal_set_component_alerts(&$component, &$localization, $summary, $dtst
break; break;
case "display": case "display":
$alarm->add(new Sabre\VObject\Property("ACTION", "DISPLAY")); $alarm->add(new Sabre\VObject\Property("ACTION", "DISPLAY"));
$text = str_replace("#name#", $summary, t("#name# is about to begin.")); $text = str_replace("#name#", $summary, L10n::t("#name# is about to begin."));
$alarm->add(new Sabre\VObject\Property("DESCRIPTION", $text)); $alarm->add(new Sabre\VObject\Property("DESCRIPTION", $text));
break; break;
default: default:
@ -735,7 +737,7 @@ function wdcal_postEditPage($uri, $uid = 0, $timezone = "", $goaway_url = "")
$vObject = dav_get_current_user_calendarobject($server, $calendar, $obj_uri, DAV_ACL_WRITE); $vObject = dav_get_current_user_calendarobject($server, $calendar, $obj_uri, DAV_ACL_WRITE);
$component = dav_get_eventComponent($vObject); $component = dav_get_eventComponent($vObject);
if ($component == null) return array("ok" => false, "msg" => t('Could not open component for editing')); if ($component == null) return array("ok" => false, "msg" => L10n::t('Could not open component for editing'));
} else { } else {
$calendar = dav_get_current_user_calendar_by_id($server, $_REQUEST["calendar"], DAV_ACL_WRITE); $calendar = dav_get_current_user_calendar_by_id($server, $_REQUEST["calendar"], DAV_ACL_WRITE);
$vObject = dav_create_empty_vevent(); $vObject = dav_create_empty_vevent();
@ -766,7 +768,7 @@ function wdcal_postEditPage($uri, $uid = 0, $timezone = "", $goaway_url = "")
$obj = $calendar->getChild($obj_uri); $obj = $calendar->getChild($obj_uri);
$obj->put($data); $obj->put($data);
} }
return array("ok" => false, "msg" => t("Saved")); return array("ok" => false, "msg" => L10n::t("Saved"));
} }

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
$a = get_app(); $a = get_app();
$uri = parse_url($a->get_baseurl()); $uri = parse_url($a->get_baseurl());
$path = "/"; $path = "/";
@ -203,9 +205,9 @@ function wdcal_create_std_calendars_get_statements($user_id, $withcheck = true)
$stms = []; $stms = [];
$a = get_app(); $a = get_app();
$uris = [ $uris = [
'private' => t("Private Calendar"), 'private' => L10n::t("Private Calendar"),
CALDAV_FRIENDICA_MINE => t("Friendica Events: Mine"), CALDAV_FRIENDICA_MINE => L10n::t("Friendica Events: Mine"),
CALDAV_FRIENDICA_CONTACTS => t("Friendica Events: Contacts"), CALDAV_FRIENDICA_CONTACTS => L10n::t("Friendica Events: Contacts"),
]; ];
foreach ($uris as $uri => $name) { foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'", $cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
@ -245,8 +247,8 @@ function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = tru
$stms = []; $stms = [];
$a = get_app(); $a = get_app();
$uris = [ $uris = [
'private' => t("Private Addresses"), 'private' => L10n::t("Private Addresses"),
CARDDAV_FRIENDICA_CONTACT => t("Friendica Contacts"), CARDDAV_FRIENDICA_CONTACT => L10n::t("Friendica Contacts"),
]; ];
foreach ($uris as $uri => $name) { foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'", $cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
{ {
@ -33,7 +35,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
* @return string * @return string
*/ */
public static function getBackendTypeName() { public static function getBackendTypeName() {
return t("Friendica-Native events"); return L10n::t("Friendica-Native events");
} }
/** /**

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
{ {
@ -33,7 +35,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
* @return string * @return string
*/ */
public static function getBackendTypeName() { public static function getBackendTypeName() {
return t("Friendica-Contacts"); return L10n::t("Friendica-Contacts");
} }
/** /**
@ -56,8 +58,8 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
'id' => $books[0]["id"], 'id' => $books[0]["id"],
'uri' => "friendica", 'uri' => "friendica",
'principaluri' => $principalUri, 'principaluri' => $principalUri,
'{DAV:}displayname' => t("Friendica-Contacts"), '{DAV:}displayname' => L10n::t("Friendica-Contacts"),
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => t("Your Friendica-Contacts"), '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => L10n::t("Your Friendica-Contacts"),
'{http://calendarserver.org/ns/}getctag' => $ctag, '{http://calendarserver.org/ns/}getctag' => $ctag,
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' => '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(), new Sabre_CardDAV_Property_SupportedAddressData(),

View file

@ -1,6 +1,7 @@
<?php <?php
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
/** /**
@ -98,7 +99,7 @@ function wdcal_import_user_ics($calendar_id) {
if (!isset($imported[$uid])) $imported[$uid] = ""; if (!isset($imported[$uid])) $imported[$uid] = "";
$imported[$uid] .= $c->serialize(); $imported[$uid] .= $c->serialize();
} catch (Exception $e) { } catch (Exception $e) {
notice(t("Something went wrong when trying to import the file. Sorry. Maybe some events were imported anyway.")); notice(L10n::t("Something went wrong when trying to import the file. Sorry. Maybe some events were imported anyway."));
} }
if (isset($_REQUEST["overwrite"])) { if (isset($_REQUEST["overwrite"])) {
@ -130,28 +131,28 @@ function wdcal_import_user_ics($calendar_id) {
$calendar->createFile("import-" . $i . ".ics", $str); $calendar->createFile("import-" . $i . ".ics", $str);
$i++; $i++;
} catch (Exception $e) { } catch (Exception $e) {
notice(t("Something went wrong when trying to import the file. Sorry.")); notice(L10n::t("Something went wrong when trying to import the file. Sorry."));
} }
$o = t("The ICS-File has been imported."); $o = L10n::t("The ICS-File has been imported.");
} catch (Exception $e) { } catch (Exception $e) {
notice(t("Something went wrong when trying to import the file. Sorry. Maybe some events were imported anyway.")); notice(L10n::t("Something went wrong when trying to import the file. Sorry. Maybe some events were imported anyway."));
} else { } else {
notice(t("No file was uploaded.")); notice(L10n::t("No file was uploaded."));
} }
} }
$o .= "<a href='" . $a->get_baseurl() . "/dav/wdcal/'>" . t("Go back to the calendar") . "</a><br><br>"; $o .= "<a href='" . $a->get_baseurl() . "/dav/wdcal/'>" . L10n::t("Go back to the calendar") . "</a><br><br>";
$num = q("SELECT COUNT(*) num FROM %s%scalendarobjects WHERE `calendar_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $calendar_id); $num = q("SELECT COUNT(*) num FROM %s%scalendarobjects WHERE `calendar_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $calendar_id);
$o .= "<h2>" . t("Import a ICS-file") . "</h2>"; $o .= "<h2>" . L10n::t("Import a ICS-file") . "</h2>";
$o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/wdcal/' . $calendar_id . '/ics-import/" enctype="multipart/form-data">'; $o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/wdcal/' . $calendar_id . '/ics-import/" enctype="multipart/form-data">';
$o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('icsimport') . "'>\n"; $o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('icsimport') . "'>\n";
$o .= "<label for='ics_file'>" . t("ICS-File") . "</label><input type='file' name='ics_file' id='ics_file'><br>\n"; $o .= "<label for='ics_file'>" . L10n::t("ICS-File") . "</label><input type='file' name='ics_file' id='ics_file'><br>\n";
if ($num[0]["num"] > 0) $o .= "<label for='overwrite'>" . str_replace("#num#", $num[0]["num"], t("Overwrite all #num# existing events")) . "</label> <input name='overwrite' id='overwrite' type='checkbox'><br>\n"; if ($num[0]["num"] > 0) $o .= "<label for='overwrite'>" . str_replace("#num#", $num[0]["num"], L10n::t("Overwrite all #num# existing events")) . "</label> <input name='overwrite' id='overwrite' type='checkbox'><br>\n";
$o .= "<input type='submit' name='save' value='" . t("Upload") . "'>"; $o .= "<input type='submit' name='save' value='" . L10n::t("Upload") . "'>";
$o .= '</form>'; $o .= '</form>';
return $o; return $o;
@ -224,14 +225,14 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
$x .= '<div class="ctoolbar"> $x .= '<div class="ctoolbar">
<div class="fbutton faddbtn" style="float: right;"> <div class="fbutton faddbtn" style="float: right;">
<div><a href="' . $a->get_baseurl() . '/dav/settings/"><span>' . t("Settings") . ' / ' . t("Help") . '</span></a></div> <div><a href="' . $a->get_baseurl() . '/dav/settings/"><span>' . L10n::t("Settings") . ' / ' . L10n::t("Help") . '</span></a></div>
</div> </div>
<div class="fbutton addcal"> <div class="fbutton addcal">
<div><a href="' . $a->get_baseurl() . '/dav/wdcal/new/" class="addcal">' . t("New event") . '</a></div> <div><a href="' . $a->get_baseurl() . '/dav/wdcal/new/" class="addcal">' . L10n::t("New event") . '</a></div>
</div> </div>
<div class="btnseparator"></div> <div class="btnseparator"></div>
<div class="fbutton showtodaybtn"> <div class="fbutton showtodaybtn">
<div><span class="showtoday">' . t("Today") . '</span></div> <div><span class="showtoday">' . L10n::t("Today") . '</span></div>
</div> </div>
<div class="btnseparator"></div> <div class="btnseparator"></div>
@ -240,37 +241,37 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
if ($view == "day") $x .= 'fcurrent'; if ($view == "day") $x .= 'fcurrent';
$x .= '">' . t("Day") . '</span></div> $x .= '">' . L10n::t("Day") . '</span></div>
</div> </div>
<div class="fbutton showweekbtn '; <div class="fbutton showweekbtn ';
if ($view == "week") $x .= "fcurrent"; if ($view == "week") $x .= "fcurrent";
$x .= '"> $x .= '">
<div><span title="Week" class="showweekview">' . t("Week") . '</span></div> <div><span title="Week" class="showweekview">' . L10n::t("Week") . '</span></div>
</div> </div>
<div class="showmonthbtn fbutton '; <div class="showmonthbtn fbutton ';
if ($view == "month") $x .= 'fcurrent'; if ($view == "month") $x .= 'fcurrent';
$x .= '"> $x .= '">
<div><span title="Month" class="showmonthview">' . t("Month") . '</span></div> <div><span title="Month" class="showmonthview">' . L10n::t("Month") . '</span></div>
</div> </div>
<div class="btnseparator"></div> <div class="btnseparator"></div>
<div class="fbutton showreflashbtn"> <div class="fbutton showreflashbtn">
<div><span class="showdayflash">' . t("Reload") . '</span></div> <div><span class="showdayflash">' . L10n::t("Reload") . '</span></div>
</div> </div>
<div class="btnseparator"></div> <div class="btnseparator"></div>
<div title="' . t("Previous") . '" class="fbutton sfprevbtn"> <div title="' . L10n::t("Previous") . '" class="fbutton sfprevbtn">
<span class="fprev"></span> <span class="fprev"></span>
</div> </div>
<div title="' . t("Next") . '" class="fbutton sfnextbtn"> <div title="' . L10n::t("Next") . '" class="fbutton sfnextbtn">
<span class="fnext"></span> <span class="fnext"></span>
</div> </div>
<div class="fshowdatep fbutton" style="white-space: nowrap; position: relative;"> <div class="fshowdatep fbutton" style="white-space: nowrap; position: relative;">
<input name="txtshow" class="hdtxtshow" style="position: absolute; bottom: 0; left: 0; width: 0; height: 0; border: 0; padding: 0; margin: 0;"> <input name="txtshow" class="hdtxtshow" style="position: absolute; bottom: 0; left: 0; width: 0; height: 0; border: 0; padding: 0; margin: 0;">
<span class="txtdatetimeshow">' . t("Date") . '</span> <span class="txtdatetimeshow">' . L10n::t("Date") . '</span>
</div> </div>
<div style="float: right;"> <div style="float: right;">
<div class="clear"></div> <div class="clear"></div>
@ -312,7 +313,7 @@ function wdcal_getDetailPage($calendar_id, $calendarobject_id)
$details = $obj; $details = $obj;
} catch (Exception $e) { } catch (Exception $e) {
info(t("Error") . ": " . $e); info(L10n::t("Error") . ": " . $e);
goaway('dav/wdcal/'); goaway('dav/wdcal/');
} }
@ -353,14 +354,14 @@ function wdcal_getSettingsPage(&$a)
{ {
if (!local_user()) { if (!local_user()) {
notice(t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }
if (isset($_REQUEST["save"])) { if (isset($_REQUEST["save"])) {
check_form_security_token_redirectOnErr('/dav/settings/', 'calprop'); check_form_security_token_redirectOnErr('/dav/settings/', 'calprop');
PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]); PConfig::set($a->user["uid"], "dav", "dateformat", $_REQUEST["wdcal_date_format"]);
info(t('The new values have been saved.')); info(L10n::t('The new values have been saved.'));
} }
if (isset($_REQUEST["save_cals"])) { if (isset($_REQUEST["save_cals"])) {
@ -379,7 +380,7 @@ function wdcal_getSettingsPage(&$a)
if ($change_sql != "") { if ($change_sql != "") {
q("UPDATE %s%scalendars SET `ctag` = `ctag` + 1 $change_sql WHERE `id` = %d AND `namespace_id` = %d AND `namespace_id` = %d", q("UPDATE %s%scalendars SET `ctag` = `ctag` + 1 $change_sql WHERE `id` = %d AND `namespace_id` = %d AND `namespace_id` = %d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $cal["id"], CALDAV_NAMESPACE_PRIVATE, IntVal($a->user["uid"])); CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $cal["id"], CALDAV_NAMESPACE_PRIVATE, IntVal($a->user["uid"]));
info(t('The calendar has been updated.')); info(L10n::t('The calendar has been updated.'));
} }
} }
@ -392,7 +393,7 @@ function wdcal_getSettingsPage(&$a)
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($a->user["uid"]), $neworder, dbesc(strtolower(substr($_REQUEST["color"]["new"], 1))), CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($a->user["uid"]), $neworder, dbesc(strtolower(substr($_REQUEST["color"]["new"], 1))),
dbesc($_REQUEST["name"]["new"]), dbesc($a->timezone), dbesc($_REQUEST["uri"]["new"]) dbesc($_REQUEST["name"]["new"]), dbesc($a->timezone), dbesc($_REQUEST["uri"]["new"])
); );
info(t('The new calendar has been created.')); info(L10n::t('The new calendar has been created.'));
} }
} }
@ -416,20 +417,20 @@ function wdcal_getSettingsPage(&$a)
q("DELETE FROM %s%scalendars WHERE `id` = %s", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["remove_cal"])); q("DELETE FROM %s%scalendars WHERE `id` = %s", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($_REQUEST["remove_cal"]));
q("UPDATE %s%scalendars SET `ctag` = `ctag` + 1 WHERE `id` = " . CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $newcal[0]["id"]); q("UPDATE %s%scalendars SET `ctag` = `ctag` + 1 WHERE `id` = " . CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $newcal[0]["id"]);
info(t('The calendar has been deleted.')); info(L10n::t('The calendar has been deleted.'));
} }
$o = ""; $o = "";
$o .= "<a href='" . $a->get_baseurl() . "/dav/wdcal/'>" . t("Go back to the calendar") . "</a><br><br>"; $o .= "<a href='" . $a->get_baseurl() . "/dav/wdcal/'>" . L10n::t("Go back to the calendar") . "</a><br><br>";
$o .= '<h3>' . t('Calendar Settings') . '</h3>'; $o .= '<h3>' . L10n::t('Calendar Settings') . '</h3>';
$current_format = wdcal_local::getInstanceByUser($a->user["uid"]); $current_format = wdcal_local::getInstanceByUser($a->user["uid"]);
$o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/settings/">'; $o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/settings/">';
$o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('calprop') . "'>\n"; $o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('calprop') . "'>\n";
$o .= '<label for="wdcal_date_format">' . t('Date format') . ':</label><select name="wdcal_date_format" id="wdcal_date_format" size="1">'; $o .= '<label for="wdcal_date_format">' . L10n::t('Date format') . ':</label><select name="wdcal_date_format" id="wdcal_date_format" size="1">';
$classes = wdcal_local::getInstanceClasses(); $classes = wdcal_local::getInstanceClasses();
foreach ($classes as $c) { foreach ($classes as $c) {
$o .= '<option value="' . $c::getID() . '" '; $o .= '<option value="' . $c::getID() . '" ';
@ -438,13 +439,13 @@ function wdcal_getSettingsPage(&$a)
} }
$o .= '</select><br>'; $o .= '</select><br>';
$o .= '<label for="wdcal_time_zone">' . t('Time zone') . ':</label><input id="wdcal_time_zone" value="' . $a->timezone . '" disabled><br>'; $o .= '<label for="wdcal_time_zone">' . L10n::t('Time zone') . ':</label><input id="wdcal_time_zone" value="' . $a->timezone . '" disabled><br>';
$o .= '<input type="submit" name="save" value="' . t('Save') . '">'; $o .= '<input type="submit" name="save" value="' . L10n::t('Save') . '">';
$o .= '</form>'; $o .= '</form>';
$o .= '<br><br><h3>' . t('Calendars') . '</h3>'; $o .= '<br><br><h3>' . L10n::t('Calendars') . '</h3>';
$o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/settings/">'; $o .= '<form method="POST" action="' . $a->get_baseurl() . '/dav/settings/">';
$o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('calprop') . "'>\n"; $o .= "<input type='hidden' name='form_security_token' value='" . get_form_security_token('calprop') . "'>\n";
$o .= "<table><tr><th>Type</th><th>Color</th><th>Name</th><th>URI (for CalDAV)</th><th>ICS</th></tr>"; $o .= "<table><tr><th>Type</th><th>Color</th><th>Name</th><th>URI (for CalDAV)</th><th>ICS</th></tr>";
@ -486,8 +487,8 @@ function wdcal_getSettingsPage(&$a)
$o .= "</tr>\n"; $o .= "</tr>\n";
$o .= "</table>"; $o .= "</table>";
$o .= "<div style='text-align: center;'>[<a href='#' class='calendar_add_caller'>" . t("Create a new calendar") . "</a>]</div>"; $o .= "<div style='text-align: center;'>[<a href='#' class='calendar_add_caller'>" . L10n::t("Create a new calendar") . "</a>]</div>";
$o .= '<input type="submit" name="save_cals" value="' . t('Save') . '">'; $o .= '<input type="submit" name="save_cals" value="' . L10n::t('Save') . '">';
$o .= '</form>'; $o .= '</form>';
$baseurl = $a->get_baseurl(); $baseurl = $a->get_baseurl();
$o .= "<script>\$(function() { $o .= "<script>\$(function() {
@ -495,22 +496,22 @@ function wdcal_getSettingsPage(&$a)
});</script>"; });</script>";
$o .= "<br><h3>" . t("Limitations") . "</h3>"; $o .= "<br><h3>" . L10n::t("Limitations") . "</h3>";
$o .= "- The native friendica events are embedded as read-only, half-transparent in the calendar.<br>"; $o .= "- The native friendica events are embedded as read-only, half-transparent in the calendar.<br>";
$o .= "<br><h3>" . t("Warning") . "</h3>"; $o .= "<br><h3>" . L10n::t("Warning") . "</h3>";
$o .= "This addon still is in a very early stage of development. Expect major bugs!<br>"; $o .= "This addon still is in a very early stage of development. Expect major bugs!<br>";
$o .= "<br><h3>" . t("Synchronization (iPhone, Thunderbird Lightning, Android, ...)") . "</h3>"; $o .= "<br><h3>" . L10n::t("Synchronization (iPhone, Thunderbird Lightning, Android, ...)") . "</h3>";
$o .= 'This addon enables synchronization of your dates and contacts with CalDAV- and CardDAV-enabled programs or devices.<br> $o .= 'This addon enables synchronization of your dates and contacts with CalDAV- and CardDAV-enabled programs or devices.<br>
As an example, the instructions how to set up two-way synchronization with an iPhone/iPodTouch are provided below.<br> As an example, the instructions how to set up two-way synchronization with an iPhone/iPodTouch are provided below.<br>
Unfortunately, Android does not have native support for CalDAV or CardDAV, so an app has to be installed.<br> Unfortunately, Android does not have native support for CalDAV or CardDAV, so an app has to be installed.<br>
On desktops, the Lightning-extension to Mozilla Thunderbird should be able to use this addon as a backend.<br><br>'; On desktops, the Lightning-extension to Mozilla Thunderbird should be able to use this addon as a backend.<br><br>';
$o .= '<h4>' . t('Synchronizing this calendar with the iPhone') . '</h4>'; $o .= '<h4>' . L10n::t('Synchronizing this calendar with the iPhone') . '</h4>';
$o .= "<ul> $o .= "<ul>
<li>Go to the settings</li> <li>Go to the settings</li>
@ -521,7 +522,7 @@ function wdcal_getSettingsPage(&$a)
<li><b>Server:</b> " . $a->get_baseurl() . "/dav/ / <b>Username/Password:</b> <em>the same as your friendica-login</em></li> <li><b>Server:</b> " . $a->get_baseurl() . "/dav/ / <b>Username/Password:</b> <em>the same as your friendica-login</em></li>
</ul>"; </ul>";
$o .= '<h4>' . t('Synchronizing your Friendica-Contacts with the iPhone') . '</h4>'; $o .= '<h4>' . L10n::t('Synchronizing your Friendica-Contacts with the iPhone') . '</h4>';
$o .= "<ul> $o .= "<ul>
<li>Go to the settings</li> <li>Go to the settings</li>

View file

@ -1,6 +1,7 @@
<?php <?php
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Module\Login; use Friendica\Module\Login;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
@ -203,7 +204,7 @@ function dav_content()
} }
} }
} catch (DAVVersionMismatchException $e) { } catch (DAVVersionMismatchException $e) {
$x = t("The current version of this addon has not been set up correctly. Please contact the system administrator of your installation of friendica to fix this."); $x = L10n::t("The current version of this addon has not been set up correctly. Please contact the system administrator of your installation of friendica to fix this.");
} }
return $x; return $x;
} }
@ -240,10 +241,10 @@ function dav_event_updated_hook(&$a, &$b)
function dav_profile_tabs_hook(&$a, &$b) function dav_profile_tabs_hook(&$a, &$b)
{ {
$b["tabs"][] = [ $b["tabs"][] = [
"label" => t('Calendar'), "label" => L10n::t('Calendar'),
"url" => $a->get_baseurl() . "/dav/wdcal/", "url" => $a->get_baseurl() . "/dav/wdcal/",
"sel" => "", "sel" => "",
"title" => t('Extended calendar with CalDAV-support'), "title" => L10n::t('Extended calendar with CalDAV-support'),
]; ];
} }
@ -281,10 +282,10 @@ function dav_cron(&$a, &$b)
$text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>"); $text_html = str_replace($find, $repl, "Hi %to%!<br>\n<br>\nThe event \"%event%\" is about to begin:<br>\n<a href='" . "%url%" . "'>%url%</a>");
$params = [ $params = [
'fromName' => FRIENDICA_PLATFORM, 'fromName' => FRIENDICA_PLATFORM,
'fromEmail' => t('noreply') . '@' . $a->get_hostname(), 'fromEmail' => L10n::t('noreply') . '@' . $a->get_hostname(),
'replyTo' => t('noreply') . '@' . $a->get_hostname(), 'replyTo' => L10n::t('noreply') . '@' . $a->get_hostname(),
'toEmail' => $user["email"], 'toEmail' => $user["email"],
'messageSubject' => t("Notification: " . $event[0]["Summary"]), 'messageSubject' => L10n::t("Notification: " . $event[0]["Summary"]),
'htmlVersion' => $text_html, 'htmlVersion' => $text_html,
'textVersion' => $text_text, 'textVersion' => $text_text,
'additionalMailHeader' => "", 'additionalMailHeader' => "",
@ -311,15 +312,15 @@ function dav_addon_admin_post(&$a = null, &$o = null)
if (isset($_REQUEST["install"])) { if (isset($_REQUEST["install"])) {
$errs = dav_create_tables(); $errs = dav_create_tables();
if (count($errs) == 0) info(t('The database tables have been installed.') . EOL); if (count($errs) == 0) info(L10n::t('The database tables have been installed.') . EOL);
else notice(t("An error occurred during the installation.") . EOL); else notice(L10n::t("An error occurred during the installation.") . EOL);
} }
if (isset($_REQUEST["upgrade"])) { if (isset($_REQUEST["upgrade"])) {
$errs = dav_upgrade_tables(); $errs = dav_upgrade_tables();
if (count($errs) == 0) { if (count($errs) == 0) {
renderAllCalDavEntries(); renderAllCalDavEntries();
info(t('The database tables have been updated.') . EOL); info(L10n::t('The database tables have been updated.') . EOL);
} else notice(t("An error occurred during the update.") . EOL); } else notice(L10n::t("An error occurred during the update.") . EOL);
} }
} }
@ -335,31 +336,31 @@ function dav_addon_admin(&$a, &$o)
$dbstatus = dav_check_tables(); $dbstatus = dav_check_tables();
$o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("dav_admin_save") . '">'; $o = '<input type="hidden" name="form_security_token" value="' . get_form_security_token("dav_admin_save") . '">';
$o .= '<i>' . t("No system-wide settings yet.") . '</i><br><br>'; $o .= '<i>' . L10n::t("No system-wide settings yet.") . '</i><br><br>';
$o .= '<h3>' . t('Database status') . '</h3>'; $o .= '<h3>' . L10n::t('Database status') . '</h3>';
switch ($dbstatus) { switch ($dbstatus) {
case 0: case 0:
$o .= t('Installed'); $o .= L10n::t('Installed');
break; break;
case 1: case 1:
case 2: case 2:
$o .= "<strong>" . t('Upgrade needed') . "</strong><br>" . t("Please back up all calendar data (the tables beginning with dav_*) before proceeding. While all calendar events <i>should</i> be converted to the new database structure, it's always safe to have a backup. Below, you can have a look at the database-queries that will be made when pressing the 'update'-button.") . "<br><br><input type='submit' name='upgrade' value='" . t('Upgrade') . "'>"; $o .= "<strong>" . L10n::t('Upgrade needed') . "</strong><br>" . L10n::t("Please back up all calendar data (the tables beginning with dav_*) before proceeding. While all calendar events <i>should</i> be converted to the new database structure, it's always safe to have a backup. Below, you can have a look at the database-queries that will be made when pressing the 'update'-button.") . "<br><br><input type='submit' name='upgrade' value='" . L10n::t('Upgrade') . "'>";
break; break;
case -1: case -1:
$o .= t('Not installed') . "<br><br><input type='submit' name='install' value='" . t('Install') . "'>"; $o .= L10n::t('Not installed') . "<br><br><input type='submit' name='install' value='" . L10n::t('Install') . "'>";
break; break;
case -2: case -2:
default: default:
$o .= t('Unknown') . "<br><br>" . t("Something really went wrong. I cannot recover from this state automatically, sorry. Please go to the database backend, back up the data, and delete all tables beginning with 'dav_' manually. Afterwards, this installation routine should be able to reinitialize the tables automatically."); $o .= L10n::t('Unknown') . "<br><br>" . L10n::t("Something really went wrong. I cannot recover from this state automatically, sorry. Please go to the database backend, back up the data, and delete all tables beginning with 'dav_' manually. Afterwards, this installation routine should be able to reinitialize the tables automatically.");
break; break;
} }
$o .= "<br><br>"; $o .= "<br><br>";
$o .= "<h3>" . t("Troubleshooting") . "</h3>"; $o .= "<h3>" . L10n::t("Troubleshooting") . "</h3>";
$o .= "<h4>" . t("Manual creation of the database tables:") . "</h4>"; $o .= "<h4>" . L10n::t("Manual creation of the database tables:") . "</h4>";
$o .= "<a href='#' onClick='\$(\"#sqlstatements\").show(); return false;'>" . t("Show SQL-statements") . "</a><blockquote style='display: none;' id='sqlstatements'><pre>"; $o .= "<a href='#' onClick='\$(\"#sqlstatements\").show(); return false;'>" . L10n::t("Show SQL-statements") . "</a><blockquote style='display: none;' id='sqlstatements'><pre>";
switch ($dbstatus) { switch ($dbstatus) {
case 1: case 2: case 1: case 2:
$tables = dav_get_update_statements($dbstatus); $tables = dav_get_update_statements($dbstatus);

View file

@ -7,9 +7,10 @@
* Author: Michael Vogel <heluecht@pirati.ca> * Author: Michael Vogel <heluecht@pirati.ca>
*/ */
require_once("addon/diaspora/Diaspora_Connection.php"); require_once 'addon/diaspora/Diaspora_Connection.php';
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Queue; use Friendica\Model\Queue;
@ -41,7 +42,7 @@ function diaspora_jot_nets(&$a,&$b) {
$diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default'); $diaspora_defpost = PConfig::get(local_user(),'diaspora','post_by_default');
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> '
. t('Post to Diaspora') . '</div>'; . L10n::t('Post to Diaspora') . '</div>';
} }
} }
@ -139,9 +140,9 @@ function diaspora_settings(&$a,&$s) {
$r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user())); $r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
if (DBM::is_result($r)) { if (DBM::is_result($r)) {
$status = sprintf(t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. "), $r[0]['addr']); $status = L10n::t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. ", $r[0]['addr']);
$status .= t('This connector is only meant if you still want to use your old Diaspora account for some time. '); $status .= L10n::t('This connector is only meant if you still want to use your old Diaspora account for some time. ');
$status .= sprintf(t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.'), $r[0]['addr']); $status .= L10n::t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.', $r[0]['addr']);
} }
$aspects = false; $aspects = false;
@ -151,18 +152,18 @@ function diaspora_settings(&$a,&$s) {
$conn->logIn(); $conn->logIn();
$aspects = $conn->getAspects(); $aspects = $conn->getAspects();
if (!$aspects) { if (!$aspects) {
$status = t("Can't login to your Diaspora account. Please check handle (in the format user@domain.tld) and password."); $status = L10n::t("Can't login to your Diaspora account. Please check handle (in the format user@domain.tld) and password.");
} }
} }
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_diaspora_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_diaspora_expanded\'); openClose(\'settings_diaspora_inflated\');">'; $s .= '<span id="settings_diaspora_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_diaspora_expanded\'); openClose(\'settings_diaspora_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/diaspora-logo.png" /><h3 class="connector">'. t('Diaspora Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/diaspora-logo.png" /><h3 class="connector">'. L10n::t('Diaspora Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_diaspora_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_diaspora_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_diaspora_expanded\'); openClose(\'settings_diaspora_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_diaspora_expanded\'); openClose(\'settings_diaspora_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/diaspora-logo.png" /><h3 class="connector">'. t('Diaspora Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/diaspora-logo.png" /><h3 class="connector">'. L10n::t('Diaspora Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
if ($status) { if ($status) {
@ -172,32 +173,32 @@ function diaspora_settings(&$a,&$s) {
} }
$s .= '<div id="diaspora-enable-wrapper">'; $s .= '<div id="diaspora-enable-wrapper">';
$s .= '<label id="diaspora-enable-label" for="diaspora-checkbox">' . t('Enable Diaspora Post Addon') . '</label>'; $s .= '<label id="diaspora-enable-label" for="diaspora-checkbox">' . L10n::t('Enable Diaspora Post Addon') . '</label>';
$s .= '<input id="diaspora-checkbox" type="checkbox" name="diaspora" value="1" ' . $checked . '/>'; $s .= '<input id="diaspora-checkbox" type="checkbox" name="diaspora" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="diaspora-username-wrapper">'; $s .= '<div id="diaspora-username-wrapper">';
$s .= '<label id="diaspora-username-label" for="diaspora-username">' . t('Diaspora handle') . '</label>'; $s .= '<label id="diaspora-username-label" for="diaspora-username">' . L10n::t('Diaspora handle') . '</label>';
$s .= '<input id="diaspora-username" type="text" name="handle" value="' . $handle . '" />'; $s .= '<input id="diaspora-username" type="text" name="handle" value="' . $handle . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="diaspora-password-wrapper">'; $s .= '<div id="diaspora-password-wrapper">';
$s .= '<label id="diaspora-password-label" for="diaspora-password">' . t('Diaspora password') . '</label>'; $s .= '<label id="diaspora-password-label" for="diaspora-password">' . L10n::t('Diaspora password') . '</label>';
$s .= '<input id="diaspora-password" type="password" name="password" value="' . $password . '" />'; $s .= '<input id="diaspora-password" type="password" name="password" value="' . $password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
if ($aspects) { if ($aspects) {
$single_aspect = new stdClass(); $single_aspect = new stdClass();
$single_aspect->id = 'all_aspects'; $single_aspect->id = 'all_aspects';
$single_aspect->name = t('All aspects'); $single_aspect->name = L10n::t('All aspects');
$aspects[] = $single_aspect; $aspects[] = $single_aspect;
$single_aspect = new stdClass(); $single_aspect = new stdClass();
$single_aspect->id = 'public'; $single_aspect->id = 'public';
$single_aspect->name = t('Public'); $single_aspect->name = L10n::t('Public');
$aspects[] = $single_aspect; $aspects[] = $single_aspect;
$s .= '<label id="diaspora-aspect-label" for="diaspora-aspect">' . t('Post to aspect:') . '</label>'; $s .= '<label id="diaspora-aspect-label" for="diaspora-aspect">' . L10n::t('Post to aspect:') . '</label>';
$s .= '<select name="aspect" id="diaspora-aspect">'; $s .= '<select name="aspect" id="diaspora-aspect">';
foreach($aspects as $single_aspect) { foreach($aspects as $single_aspect) {
if ($single_aspect->id == $aspect) if ($single_aspect->id == $aspect)
@ -211,13 +212,13 @@ function diaspora_settings(&$a,&$s) {
} }
$s .= '<div id="diaspora-bydefault-wrapper">'; $s .= '<div id="diaspora-bydefault-wrapper">';
$s .= '<label id="diaspora-bydefault-label" for="diaspora-bydefault">' . t('Post to Diaspora by default') . '</label>'; $s .= '<label id="diaspora-bydefault-label" for="diaspora-bydefault">' . L10n::t('Post to Diaspora by default') . '</label>';
$s .= '<input id="diaspora-bydefault" type="checkbox" name="diaspora_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="diaspora-bydefault" type="checkbox" name="diaspora_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="diaspora-submit" name="diaspora-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="diaspora-submit" name="diaspora-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
@ -368,7 +369,7 @@ function diaspora_send(&$a,&$b) {
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $body]);
Queue::add($a->contact, NETWORK_DIASPORA2, $s); Queue::add($a->contact, NETWORK_DIASPORA2, $s);
notice(t('Diaspora post failed. Queued for retry.').EOL); notice(L10n::t('Diaspora post failed. Queued for retry.').EOL);
} }
} }
} }

View file

@ -8,6 +8,7 @@
* Author: Cat Gray <https://free-haven.org/profile/catness> * Author: Cat Gray <https://free-haven.org/profile/catness>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function dwpost_install() { function dwpost_install() {
@ -37,7 +38,7 @@ function dwpost_jot_nets(&$a,&$b) {
$dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default'); $dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Dreamwidth') . '</div>'; . L10n::t('Post to Dreamwidth') . '</div>';
} }
} }
@ -68,36 +69,36 @@ function dwpost_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_dwpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_dwpost_expanded\'); openClose(\'settings_dwpost_inflated\');">'; $s .= '<span id="settings_dwpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_dwpost_expanded\'); openClose(\'settings_dwpost_inflated\');">';
$s .= '<img class="connector" src="images/dreamwidth.png" /><h3 class="connector">'. t("Dreamwidth Export").'</h3>'; $s .= '<img class="connector" src="images/dreamwidth.png" /><h3 class="connector">'. L10n::t("Dreamwidth Export").'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_dwpost_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_dwpost_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_dwpost_expanded\'); openClose(\'settings_dwpost_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_dwpost_expanded\'); openClose(\'settings_dwpost_inflated\');">';
$s .= '<img class="connector" src="images/dreamwidth.png" /><h3 class="connector">'. t("Dreamwidth Export").'</h3>'; $s .= '<img class="connector" src="images/dreamwidth.png" /><h3 class="connector">'. L10n::t("Dreamwidth Export").'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="dwpost-enable-wrapper">'; $s .= '<div id="dwpost-enable-wrapper">';
$s .= '<label id="dwpost-enable-label" for="dwpost-checkbox">' . t('Enable dreamwidth Post Addon') . '</label>'; $s .= '<label id="dwpost-enable-label" for="dwpost-checkbox">' . L10n::t('Enable dreamwidth Post Addon') . '</label>';
$s .= '<input id="dwpost-checkbox" type="checkbox" name="dwpost" value="1" ' . $checked . '/>'; $s .= '<input id="dwpost-checkbox" type="checkbox" name="dwpost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-username-wrapper">'; $s .= '<div id="dwpost-username-wrapper">';
$s .= '<label id="dwpost-username-label" for="dwpost-username">' . t('dreamwidth username') . '</label>'; $s .= '<label id="dwpost-username-label" for="dwpost-username">' . L10n::t('dreamwidth username') . '</label>';
$s .= '<input id="dwpost-username" type="text" name="dw_username" value="' . $dw_username . '" />'; $s .= '<input id="dwpost-username" type="text" name="dw_username" value="' . $dw_username . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-password-wrapper">'; $s .= '<div id="dwpost-password-wrapper">';
$s .= '<label id="dwpost-password-label" for="dwpost-password">' . t('dreamwidth password') . '</label>'; $s .= '<label id="dwpost-password-label" for="dwpost-password">' . L10n::t('dreamwidth password') . '</label>';
$s .= '<input id="dwpost-password" type="password" name="dw_password" value="' . $dw_password . '" />'; $s .= '<input id="dwpost-password" type="password" name="dw_password" value="' . $dw_password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="dwpost-bydefault-wrapper">'; $s .= '<div id="dwpost-bydefault-wrapper">';
$s .= '<label id="dwpost-bydefault-label" for="dwpost-bydefault">' . t('Post to dreamwidth by default') . '</label>'; $s .= '<label id="dwpost-bydefault-label" for="dwpost-bydefault">' . L10n::t('Post to dreamwidth by default') . '</label>';
$s .= '<input id="dwpost-bydefault" type="checkbox" name="dw_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="dwpost-bydefault" type="checkbox" name="dw_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="dwpost-submit" name="dwpost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="dwpost-submit" name="dwpost-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: Forum Directory * Name: Forum Directory
* Description: Add a directory of forums hosted on your server, with verbose descriptions. * Description: Add a directory of forums hosted on your server, with verbose descriptions.
@ -11,6 +10,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -18,11 +18,13 @@ require_once 'boot.php';
require_once 'include/dba.php'; require_once 'include/dba.php';
require_once 'include/text.php'; require_once 'include/text.php';
function forumdirectory_install() { function forumdirectory_install()
{
Addon::registerHook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); Addon::registerHook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
} }
function forumdirectory_uninstall() { function forumdirectory_uninstall()
{
Addon::unregisterHook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); Addon::unregisterHook('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
} }
@ -33,7 +35,7 @@ function forumdirectory_module()
function forumdirectory_app_menu($a, &$b) function forumdirectory_app_menu($a, &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . t('Forum Directory') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . L10n::t('Forum Directory') . '</a></div>';
} }
function forumdirectory_init(&$a) function forumdirectory_init(&$a)
@ -59,7 +61,7 @@ function forumdirectory_post(&$a)
function forumdirectory_content(&$a) function forumdirectory_content(&$a)
{ {
if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) { if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
notice(t('Public access denied.') . EOL); notice(L10n::t('Public access denied.') . EOL);
return; return;
} }
@ -78,7 +80,7 @@ function forumdirectory_content(&$a)
$gdirpath = Config::get('system', 'directory'); $gdirpath = Config::get('system', 'directory');
if (strlen($gdirpath)) { if (strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="' $globaldir = '<ul><li><div id="global-directory-link"><a href="'
. Profile::zrl($gdirpath, true) . '">' . t('Global Directory') . '</a></div></li></ul>'; . Profile::zrl($gdirpath, true) . '">' . L10n::t('Global Directory') . '</a></div></li></ul>';
} }
$admin = ''; $admin = '';
@ -86,11 +88,11 @@ function forumdirectory_content(&$a)
$o .= replace_macros($tpl, [ $o .= replace_macros($tpl, [
'$search' => $search, '$search' => $search,
'$globaldir' => $globaldir, '$globaldir' => $globaldir,
'$desc' => t('Find on this site'), '$desc' => L10n::t('Find on this site'),
'$admin' => $admin, '$admin' => $admin,
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""), '$finding' => (strlen($search) ? '<h4>' . L10n::t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'), '$sitedir' => L10n::t('Site Directory'),
'$submit' => t('Find') '$submit' => L10n::t('Find')
]); ]);
$sql_extra = ''; $sql_extra = '';
@ -148,11 +150,11 @@ function forumdirectory_content(&$a)
} }
if (strlen($rr['dob']) && ($years = age($rr['dob'], $rr['timezone'], '')) != 0) { if (strlen($rr['dob']) && ($years = age($rr['dob'], $rr['timezone'], '')) != 0) {
$details .= '<br />' . t('Age: ') . $years; $details .= '<br />' . L10n::t('Age: ') . $years;
} }
if (strlen($rr['gender'])) { if (strlen($rr['gender'])) {
$details .= '<br />' . t('Gender: ') . $rr['gender']; $details .= '<br />' . L10n::t('Gender: ') . $rr['gender'];
} }
switch ($rr['page-flags']) { switch ($rr['page-flags']) {
@ -172,13 +174,13 @@ function forumdirectory_content(&$a)
|| x($profile, 'postal-code') == 1 || x($profile, 'postal-code') == 1
|| x($profile, 'country-name') == 1 || x($profile, 'country-name') == 1
) { ) {
$location = t('Location:'); $location = L10n::t('Location:');
} }
$gender = x($profile, 'gender') == 1 ? t('Gender:') : false; $gender = x($profile, 'gender') == 1 ? L10n::t('Gender:') : false;
$marital = x($profile, 'marital') == 1 ? t('Status:') : false; $marital = x($profile, 'marital') == 1 ? L10n::t('Status:') : false;
$homepage = x($profile, 'homepage') == 1 ? t('Homepage:') : false; $homepage = x($profile, 'homepage') == 1 ? L10n::t('Homepage:') : false;
$about = x($profile, 'about') == 1 ? t('About:') : false; $about = x($profile, 'about') == 1 ? L10n::t('About:') : false;
$tpl = get_markup_template('forumdirectory_item.tpl', 'addon/forumdirectory/'); $tpl = get_markup_template('forumdirectory_item.tpl', 'addon/forumdirectory/');
@ -205,7 +207,7 @@ function forumdirectory_content(&$a)
$o .= "<div class=\"directory-end\" ></div>\r\n"; $o .= "<div class=\"directory-end\" ></div>\r\n";
$o .= paginate($a); $o .= paginate($a);
} else { } else {
info(t("No entries \x28some entries may be hidden\x29.") . EOL); info(L10n::t("No entries \x28some entries may be hidden\x29.") . EOL);
} }
return $o; return $o;

View file

@ -7,42 +7,43 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function fromapp_install() { function fromapp_install()
{
Addon::registerHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook'); Addon::registerHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
Addon::registerHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings'); Addon::registerHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
Addon::registerHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post'); Addon::registerHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("installed fromapp"); logger("installed fromapp");
} }
function fromapp_uninstall() { function fromapp_uninstall()
{
Addon::unregisterHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook'); Addon::unregisterHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
Addon::unregisterHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings'); Addon::unregisterHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
Addon::unregisterHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post'); Addon::unregisterHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
logger("removed fromapp"); logger("removed fromapp");
} }
function fromapp_settings_post($a,$post) { function fromapp_settings_post($a, $post)
if(! local_user() || (! x($_POST,'fromapp-submit'))) {
if (!local_user() || (! x($_POST, 'fromapp-submit'))) {
return; return;
}
PConfig::set(local_user(),'fromapp','app',$_POST['fromapp-input']); PConfig::set(local_user(), 'fromapp', 'app', $_POST['fromapp-input']);
PConfig::set(local_user(),'fromapp','force',intval($_POST['fromapp-force'])); PConfig::set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
info( t('Fromapp settings updated.') . EOL); info(L10n::t('Fromapp settings updated.') . EOL);
} }
function fromapp_settings(&$a,&$s) { function fromapp_settings(&$a, &$s)
{
if(! local_user()) if (!local_user()) {
return; return;
}
/* Add our stylesheet to the page so we can make our settings look nice */ /* Add our stylesheet to the page so we can make our settings look nice */
@ -50,9 +51,9 @@ function fromapp_settings(&$a,&$s) {
/* Get the current state of our config variable */ /* Get the current state of our config variable */
$fromapp = PConfig::get(local_user(),'fromapp', 'app', ''); $fromapp = PConfig::get(local_user(), 'fromapp', 'app', '');
$force = intval(PConfig::get(local_user(),'fromapp','force')); $force = intval(PConfig::get(local_user(), 'fromapp', 'force'));
$force_enabled = (($force) ? ' checked="checked" ' : ''); $force_enabled = (($force) ? ' checked="checked" ' : '');
@ -60,26 +61,25 @@ function fromapp_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_fromapp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">'; $s .= '<span id="settings_fromapp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">';
$s .= '<h3>' . t('FromApp Settings') . '</h3>'; $s .= '<h3>' . L10n::t('FromApp Settings') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_fromapp_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_fromapp_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">';
$s .= '<h3>' . t('FromApp Settings') . '</h3>'; $s .= '<h3>' . L10n::t('FromApp Settings') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="fromapp-wrapper">'; $s .= '<div id="fromapp-wrapper">';
$s .= '<label id="fromapp-label" for="fromapp-input">' . t('The application name you would like to show your posts originating from.') . '</label>'; $s .= '<label id="fromapp-label" for="fromapp-input">' . L10n::t('The application name you would like to show your posts originating from.') . '</label>';
$s .= '<input id="fromapp-input" type="text" name="fromapp-input" value="' . $fromapp . '" ' . '/>'; $s .= '<input id="fromapp-input" type="text" name="fromapp-input" value="' . $fromapp . '" ' . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="fromapp-force-label" for="fromapp-force">' . t('Use this application name even if another application was used.') . '</label>'; $s .= '<label id="fromapp-force-label" for="fromapp-force">' . L10n::t('Use this application name even if another application was used.') . '</label>';
$s .= '<input id="fromapp-force" type="checkbox" name="fromapp-force" value="1" ' . $force_enabled . '/>'; $s .= '<input id="fromapp-force" type="checkbox" name="fromapp-force" value="1" ' . $force_enabled . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="fromapp-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="fromapp-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
function fromapp_post_hook(&$a, &$item) function fromapp_post_hook(&$a, &$item)

View file

@ -11,6 +11,7 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Object\Image; use Friendica\Object\Image;
@ -49,27 +50,27 @@ function fromgplus_addon_settings(&$a,&$s) {
$account = PConfig::get(local_user(),'fromgplus','account'); $account = PConfig::get(local_user(),'fromgplus','account');
$s .= '<span id="settings_fromgplus_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">'; $s .= '<span id="settings_fromgplus_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">';
$s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. t('Google+ Mirror').'</h3>'; $s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. L10n::t('Google+ Mirror').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_fromgplus_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_fromgplus_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_fromgplus_expanded\'); openClose(\'settings_fromgplus_inflated\');">';
$s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. t('Google+ Mirror').'</h3>'; $s .= '<img class="connector" src="images/googleplus.png" /><h3 class="connector">'. L10n::t('Google+ Mirror').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="fromgplus-wrapper">'; $s .= '<div id="fromgplus-wrapper">';
$s .= '<label id="fromgplus-enable-label" for="fromgplus-enable">'.t('Enable Google+ Import').'</label>'; $s .= '<label id="fromgplus-enable-label" for="fromgplus-enable">'.L10n::t('Enable Google+ Import').'</label>';
$s .= '<input id="fromgplus-enable" type="checkbox" name="fromgplus-enable" value="1"'.$enable_checked.' />'; $s .= '<input id="fromgplus-enable" type="checkbox" name="fromgplus-enable" value="1"'.$enable_checked.' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="fromgplus-label" for="fromgplus-account">'.t('Google Account ID').' </label>'; $s .= '<label id="fromgplus-label" for="fromgplus-account">'.L10n::t('Google Account ID').' </label>';
$s .= '<input id="fromgplus-account" type="text" name="fromgplus-account" value="'.$account.'" />'; $s .= '<input id="fromgplus-account" type="text" name="fromgplus-account" value="'.$account.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<label id="fromgplus-keywords-label" for="fromgplus-keywords">'.t('Add keywords to post').'</label>'; $s .= '<label id="fromgplus-keywords-label" for="fromgplus-keywords">'.L10n::t('Add keywords to post').'</label>';
$s .= '<input id="fromgplus-keywords" type="checkbox" name="fromgplus-keywords" value="1"'.$keywords_checked.' />'; $s .= '<input id="fromgplus-keywords" type="checkbox" name="fromgplus-keywords" value="1"'.$keywords_checked.' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fromgplus-submit" name="fromgplus-submit" $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fromgplus-submit" name="fromgplus-submit"
class="settings-submit" value="' . t('Save Settings') . '" /></div>'; class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>'; $s .= '</div>';
return; return;
@ -90,7 +91,7 @@ function fromgplus_addon_settings_post(&$a,&$b) {
if (!$enable) if (!$enable)
PConfig::delete(local_user(),'fromgplus','lastdate'); PConfig::delete(local_user(),'fromgplus','lastdate');
info( t('Google+ Import Settings saved.') . EOL); info(L10n::t('Google+ Import Settings saved.') . EOL);
} }
} }
@ -99,8 +100,8 @@ function fromgplus_addon_admin(&$a, &$o)
$t = get_markup_template("admin.tpl", "addon/fromgplus/"); $t = get_markup_template("admin.tpl", "addon/fromgplus/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$key' => ['key', t('Key'), trim(Config::get('fromgplus', 'key')), t('')], '$key' => ['key', L10n::t('Key'), trim(Config::get('fromgplus', 'key')), L10n::t('')],
]); ]);
} }
@ -108,7 +109,7 @@ function fromgplus_addon_admin_post(&$a)
{ {
$key = ((x($_POST, 'key')) ? trim($_POST['key']) : ''); $key = ((x($_POST, 'key')) ? trim($_POST['key']) : '');
Config::set('fromgplus', 'key', $key); Config::set('fromgplus', 'key', $key);
info(t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }
function fromgplus_cron($a,$b) { function fromgplus_cron($a,$b) {

View file

@ -8,6 +8,7 @@
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function geocoordinates_install() function geocoordinates_install()
{ {
@ -87,9 +88,9 @@ function geocoordinates_addon_admin(&$a, &$o)
$t = get_markup_template("admin.tpl", "addon/geocoordinates/"); $t = get_markup_template("admin.tpl", "addon/geocoordinates/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$api_key' => ['api_key', t('API Key'), Config::get('geocoordinates', 'api_key'), ''], '$api_key' => ['api_key', L10n::t('API Key'), Config::get('geocoordinates', 'api_key'), ''],
'$language' => ['language', t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''], '$language' => ['language', L10n::t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''],
]); ]);
} }
@ -100,5 +101,5 @@ function geocoordinates_addon_admin_post(&$a)
$language = ((x($_POST, 'language')) ? notags(trim($_POST['language'])) : ''); $language = ((x($_POST, 'language')) ? notags(trim($_POST['language'])) : '');
Config::set('geocoordinates', 'language', $language); Config::set('geocoordinates', 'language', $language);
info(t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }

View file

@ -21,6 +21,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function geonames_install() { function geonames_install() {
@ -142,7 +143,7 @@ function geonames_addon_admin_post($a,$post) {
return; return;
PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames'])); PConfig::set(local_user(),'geonames','enable',intval($_POST['geonames']));
info( t('Geonames settings updated.') . EOL); info(L10n::t('Geonames settings updated.') . EOL);
} }
@ -178,14 +179,14 @@ function geonames_addon_admin(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Geonames Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Geonames Settings') . '</h3>';
$s .= '<div id="geonames-enable-wrapper">'; $s .= '<div id="geonames-enable-wrapper">';
$s .= '<label id="geonames-enable-label" for="geonames-checkbox">' . t('Enable Geonames Addon') . '</label>'; $s .= '<label id="geonames-enable-label" for="geonames-checkbox">' . L10n::t('Enable Geonames Addon') . '</label>';
$s .= '<input id="geonames-checkbox" type="checkbox" name="geonames" value="1" ' . $checked . '/>'; $s .= '<input id="geonames-checkbox" type="checkbox" name="geonames" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="geonames-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="geonames-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -8,6 +8,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function gnot_install() { function gnot_install() {
@ -46,7 +47,7 @@ function gnot_settings_post($a,$post) {
return; return;
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot'])); PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
info( t('Gnot settings updated.') . EOL); info(L10n::t('Gnot settings updated.') . EOL);
} }
@ -77,16 +78,16 @@ function gnot_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Gnot Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Gnot Settings') . '</h3>';
$s .= '<div id="gnot-wrapper">'; $s .= '<div id="gnot-wrapper">';
$s .= '<div id="gnot-desc">' . t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '</div>'; $s .= '<div id="gnot-desc">' . L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '</div>';
$s .= '<label id="gnot-label" for="gnot">' . t('Enable this addon?') . '</label>'; $s .= '<label id="gnot-label" for="gnot">' . L10n::t('Enable this addon?') . '</label>';
$s .= '<input id="gnot-input" type="checkbox" name="gnot" value="1"'. $gnot_checked . '/>'; $s .= '<input id="gnot-input" type="checkbox" name="gnot" value="1"'. $gnot_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="gnot-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="gnot-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
@ -95,6 +96,5 @@ function gnot_enotify_mail(&$a,&$b) {
if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable')))) if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable'))))
return; return;
if($b['type'] == NOTIFY_COMMENT) if($b['type'] == NOTIFY_COMMENT)
$b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']); $b['subject'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']);
} }

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
/** /**
* Installs the addon hook * Installs the addon hook
@ -70,11 +71,11 @@ function gravatar_addon_admin (&$a, &$o) {
// Available options for the select boxes // Available options for the select boxes
$default_avatars = [ $default_avatars = [
'mm' => t('generic profile image'), 'mm' => L10n::t('generic profile image'),
'identicon' => t('random geometric pattern'), 'identicon' => L10n::t('random geometric pattern'),
'monsterid' => t('monster face'), 'monsterid' => L10n::t('monster face'),
'wavatar' => t('computer generated face'), 'wavatar' => L10n::t('computer generated face'),
'retro' => t('retro arcade style face'), 'retro' => L10n::t('retro arcade style face'),
]; ];
$ratings = [ $ratings = [
'g' => 'g', 'g' => 'g',
@ -88,15 +89,15 @@ function gravatar_addon_admin (&$a, &$o) {
dbesc('libravatar') dbesc('libravatar')
); );
if (count($r)) { if (count($r)) {
$o = '<h5>' .t('Information') .'</h5><p>' .t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>'; $o = '<h5>' .L10n::t('Information') .'</h5><p>' .L10n::t('Libravatar addon is installed, too. Please disable Libravatar addon or this Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>';
} }
// output Gravatar settings // output Gravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">'; $o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("gravatarsave") .'">';
$o .= replace_macros( $t, [ $o .= replace_macros( $t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$default_avatar' => ['avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars], '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars],
'$rating' => ['rating', t('Rating of images'), $rating, t('Select the appropriate avatar rating for your site. See README'), $ratings], '$rating' => ['rating', L10n::t('Rating of images'), $rating, L10n::t('Select the appropriate avatar rating for your site. See README'), $ratings],
]); ]);
} }
@ -110,6 +111,5 @@ function gravatar_addon_admin_post (&$a) {
$rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g'); $rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g');
Config::set('gravatar', 'default_img', $default_avatar); Config::set('gravatar', 'default_img', $default_avatar);
Config::set('gravatar', 'rating', $rating); Config::set('gravatar', 'rating', $rating);
info( t('Gravatar settings updated.') .EOL); info(L10n::t('Gravatar settings updated.') .EOL);
} }
?>

View file

@ -6,6 +6,7 @@
* Author: Thomas Willingham <https://kakste.com/profile/beardyunixer> * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function group_text_install() { function group_text_install() {
@ -42,7 +43,7 @@ function group_text_settings_post($a,$post) {
return; return;
PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); PConfig::set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text']));
info( t('Group Text settings updated.') . EOL); info(L10n::t('Group Text settings updated.') . EOL);
} }
@ -72,14 +73,14 @@ function group_text_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Group Text') . '</h3>'; $s .= '<h3>' . L10n::t('Group Text') . '</h3>';
$s .= '<div id="group_text-enable-wrapper">'; $s .= '<div id="group_text-enable-wrapper">';
$s .= '<label id="group_text-enable-label" for="group_text-checkbox">' . t('Use a text only (non-image) group selector in the "group edit" menu') . '</label>'; $s .= '<label id="group_text-enable-label" for="group_text-checkbox">' . L10n::t('Use a text only (non-image) group selector in the "group edit" menu') . '</label>';
$s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>'; $s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -12,6 +12,7 @@ require_once 'include/text.php';
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -51,35 +52,35 @@ function ifttt_settings(App $a, &$s)
} }
$s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">'; $s .= '<span id="settings_ifttt_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
$s .= '<img class="connector" src="addon/ifttt/ifttt.png" /><h3 class="connector">' . t('IFTTT Mirror') . '</h3>'; $s .= '<img class="connector" src="addon/ifttt/ifttt.png" /><h3 class="connector">' . L10n::t('IFTTT Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_ifttt_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_ifttt_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_ifttt_expanded\'); openClose(\'settings_ifttt_inflated\');">';
$s .= '<img class="connector" src="addon/ifttt/ifttt.png" /><h3 class="connector">' . t('IFTTT Mirror') . '</h3>'; $s .= '<img class="connector" src="addon/ifttt/ifttt.png" /><h3 class="connector">' . L10n::t('IFTTT Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="ifttt-configuration-wrapper">'; $s .= '<div id="ifttt-configuration-wrapper">';
$s .= '<p>' . t('Create an account at <a href="http://www.ifttt.com">IFTTT</a>. Create three Facebook recipes that are connected with <a href="https://ifttt.com/maker">Maker</a> (In the form "if Facebook then Maker") with the following parameters:') . '</p>'; $s .= '<p>' . L10n::t('Create an account at <a href="http://www.ifttt.com">IFTTT</a>. Create three Facebook recipes that are connected with <a href="https://ifttt.com/maker">Maker</a> (In the form "if Facebook then Maker") with the following parameters:') . '</p>';
$s .= '<h4>URL</h4>'; $s .= '<h4>URL</h4>';
$s .= '<p>' . $a->get_baseurl() . '/ifttt/' . $a->user['nickname'] . '</p>'; $s .= '<p>' . $a->get_baseurl() . '/ifttt/' . $a->user['nickname'] . '</p>';
$s .= '<h4>Method</h4>'; $s .= '<h4>Method</h4>';
$s .= '<p>POST</p>'; $s .= '<p>POST</p>';
$s .= '<h4>Content Type</h4>'; $s .= '<h4>Content Type</h4>';
$s .= '<p>application/x-www-form-urlencoded</p>'; $s .= '<p>application/x-www-form-urlencoded</p>';
$s .= '<h4>' . t('Body for "new status message"') . '</h4>'; $s .= '<h4>' . L10n::t('Body for "new status message"') . '</h4>';
$s .= '<p><code>' . htmlentities('key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>'; $s .= '<p><code>' . htmlentities('key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>';
$s .= '<h4>' . t('Body for "new photo upload"') . '</h4>'; $s .= '<h4>' . L10n::t('Body for "new photo upload"') . '</h4>';
$s .= '<p><code>' . htmlentities('key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>'; $s .= '<p><code>' . htmlentities('key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>';
$s .= '<h4>' . t('Body for "new link post"') . '</h4>'; $s .= '<h4>' . L10n::t('Body for "new link post"') . '</h4>';
$s .= '<p><code>' . htmlentities('key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>'; $s .= '<p><code>' . htmlentities('key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>') . '</code></p>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ifttt-rekey-wrapper">'; $s .= '<div id="ifttt-rekey-wrapper">';
$s .= '<label id="ifttt-rekey-label" for="ifttt-checkbox">' . t('Generate new key') . '</label>'; $s .= '<label id="ifttt-rekey-label" for="ifttt-checkbox">' . L10n::t('Generate new key') . '</label>';
$s .= '<input id="ifttt-checkbox" type="checkbox" name="ifttt-rekey" value="1" />'; $s .= '<input id="ifttt-checkbox" type="checkbox" name="ifttt-rekey" value="1" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="ifttt-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="ifttt-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>'; $s .= '</div>';
} }

View file

@ -8,6 +8,7 @@
* Author: Cat Gray <https://free-haven.org/profile/catness> * Author: Cat Gray <https://free-haven.org/profile/catness>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function ijpost_install() { function ijpost_install() {
@ -37,7 +38,7 @@ function ijpost_jot_nets(&$a,&$b) {
$ij_defpost = PConfig::get(local_user(),'ijpost','post_by_default'); $ij_defpost = PConfig::get(local_user(),'ijpost','post_by_default');
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
. t('Post to Insanejournal') . '</div>'; . L10n::t('Post to Insanejournal') . '</div>';
} }
} }
@ -67,36 +68,36 @@ function ijpost_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_ijpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ijpost_expanded\'); openClose(\'settings_ijpost_inflated\');">'; $s .= '<span id="settings_ijpost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_ijpost_expanded\'); openClose(\'settings_ijpost_inflated\');">';
$s .= '<img class="connector" src="images/insanejournal.gif" /><h3 class="connector">'. t("InsaneJournal Export").'</h3>'; $s .= '<img class="connector" src="images/insanejournal.gif" /><h3 class="connector">'. L10n::t("InsaneJournal Export").'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_ijpost_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_ijpost_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_ijpost_expanded\'); openClose(\'settings_ijpost_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_ijpost_expanded\'); openClose(\'settings_ijpost_inflated\');">';
$s .= '<img class="connector" src="images/insanejournal.gif" /><h3 class="connector">'. t("InsaneJournal Export").'</h3>'; $s .= '<img class="connector" src="images/insanejournal.gif" /><h3 class="connector">'. L10n::t("InsaneJournal Export").'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="ijpost-enable-wrapper">'; $s .= '<div id="ijpost-enable-wrapper">';
$s .= '<label id="ijpost-enable-label" for="ijpost-checkbox">' . t('Enable InsaneJournal Post Addon') . '</label>'; $s .= '<label id="ijpost-enable-label" for="ijpost-checkbox">' . L10n::t('Enable InsaneJournal Post Addon') . '</label>';
$s .= '<input id="ijpost-checkbox" type="checkbox" name="ijpost" value="1" ' . $checked . '/>'; $s .= '<input id="ijpost-checkbox" type="checkbox" name="ijpost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-username-wrapper">'; $s .= '<div id="ijpost-username-wrapper">';
$s .= '<label id="ijpost-username-label" for="ijpost-username">' . t('InsaneJournal username') . '</label>'; $s .= '<label id="ijpost-username-label" for="ijpost-username">' . L10n::t('InsaneJournal username') . '</label>';
$s .= '<input id="ijpost-username" type="text" name="ij_username" value="' . $ij_username . '" />'; $s .= '<input id="ijpost-username" type="text" name="ij_username" value="' . $ij_username . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-password-wrapper">'; $s .= '<div id="ijpost-password-wrapper">';
$s .= '<label id="ijpost-password-label" for="ijpost-password">' . t('InsaneJournal password') . '</label>'; $s .= '<label id="ijpost-password-label" for="ijpost-password">' . L10n::t('InsaneJournal password') . '</label>';
$s .= '<input id="ijpost-password" type="password" name="ij_password" value="' . $ij_password . '" />'; $s .= '<input id="ijpost-password" type="password" name="ij_password" value="' . $ij_password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ijpost-bydefault-wrapper">'; $s .= '<div id="ijpost-bydefault-wrapper">';
$s .= '<label id="ijpost-bydefault-label" for="ijpost-bydefault">' . t('Post to InsaneJournal by default') . '</label>'; $s .= '<label id="ijpost-bydefault-label" for="ijpost-bydefault">' . L10n::t('Post to InsaneJournal by default') . '</label>';
$s .= '<input id="ijpost-bydefault" type="checkbox" name="ij_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="ijpost-bydefault" type="checkbox" name="ij_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ijpost-submit" name="ijpost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ijpost-submit" name="ijpost-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -7,11 +7,12 @@
* License: 3-clause BSD license * License: 3-clause BSD license
*/ */
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
require_once('mod/proxy.php'); require_once 'mod/proxy.php';
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function impressum_install() { function impressum_install() {
Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
@ -46,7 +47,7 @@ function impressum_footer($a, &$b) {
} }
} }
function impressum_show($a,&$b) { function impressum_show($a,&$b) {
$b .= '<h3>'.t('Impressum').'</h3>'; $b .= '<h3>'.L10n::t('Impressum').'</h3>';
$owner = Config::get('impressum', 'owner'); $owner = Config::get('impressum', 'owner');
$owner_profile = Config::get('impressum','ownerprofile'); $owner_profile = Config::get('impressum','ownerprofile');
$postal = proxy_parse_html(bbcode(Config::get('impressum', 'postal'), true)); $postal = proxy_parse_html(bbcode(Config::get('impressum', 'postal'), true));
@ -59,18 +60,18 @@ function impressum_show($a,&$b) {
$tmp = $owner; $tmp = $owner;
} }
if (strlen($email)) { if (strlen($email)) {
$b .= '<p><strong>'.t('Site Owner').'</strong>: '. $tmp .'<br /><strong>'.t('Email Address').'</strong>: '.$email.'</p>'; $b .= '<p><strong>'.L10n::t('Site Owner').'</strong>: '. $tmp .'<br /><strong>'.L10n::t('Email Address').'</strong>: '.$email.'</p>';
} else { } else {
$b .= '<p><strong>'.t('Site Owner').'</strong>: '. $tmp .'</p>'; $b .= '<p><strong>'.L10n::t('Site Owner').'</strong>: '. $tmp .'</p>';
} }
if (strlen($postal)) { if (strlen($postal)) {
$b .= '<p><strong>'.t('Postal Address').'</strong><br />'. $postal .'</p>'; $b .= '<p><strong>'.L10n::t('Postal Address').'</strong><br />'. $postal .'</p>';
} }
if (strlen($notes)) { if (strlen($notes)) {
$b .= '<p>'.$notes.'</p>'; $b .= '<p>'.$notes.'</p>';
} }
} else { } else {
$b .= '<p>'.t('The impressum addon needs to be configured!<br />Please add at least the <tt>owner</tt> variable to your config file. For other variables please refer to the README file of the addon.').'</p>'; $b .= '<p>'.L10n::t('The impressum addon needs to be configured!<br />Please add at least the <tt>owner</tt> variable to your config file. For other variables please refer to the README file of the addon.').'</p>';
} }
} }
@ -87,17 +88,17 @@ function impressum_addon_admin_post (&$a) {
Config::set('impressum','email',strip_tags($email)); Config::set('impressum','email',strip_tags($email));
Config::set('impressum','notes',strip_tags($notes)); Config::set('impressum','notes',strip_tags($notes));
Config::set('impressum','footer_text',strip_tags($footer_text)); Config::set('impressum','footer_text',strip_tags($footer_text));
info( t('Settings updated.'). EOL ); info(L10n::t('Settings updated.'). EOL );
} }
function impressum_addon_admin (&$a, &$o) { function impressum_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/impressum/" ); $t = get_markup_template( "admin.tpl", "addon/impressum/" );
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$owner' => ['owner', t('Site Owner'), Config::get('impressum','owner'), t('The page operators name.')], '$owner' => ['owner', L10n::t('Site Owner'), Config::get('impressum','owner'), L10n::t('The page operators name.')],
'$ownerprofile' => ['ownerprofile', t('Site Owners Profile'), Config::get('impressum','ownerprofile'), t('Profile address of the operator.')], '$ownerprofile' => ['ownerprofile', L10n::t('Site Owners Profile'), Config::get('impressum','ownerprofile'), L10n::t('Profile address of the operator.')],
'$postal' => ['postal', t('Postal Address'), Config::get('impressum','postal'), t('How to contact the operator via snail mail. You can use BBCode here.')], '$postal' => ['postal', L10n::t('Postal Address'), Config::get('impressum','postal'), L10n::t('How to contact the operator via snail mail. You can use BBCode here.')],
'$notes' => ['notes', t('Notes'), Config::get('impressum','notes'), t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')], '$notes' => ['notes', L10n::t('Notes'), Config::get('impressum','notes'), L10n::t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')],
'$email' => ['email', t('Email Address'), Config::get('impressum','email'), t('How to contact the operator via email. (will be displayed obfuscated)')], '$email' => ['email', L10n::t('Email Address'), Config::get('impressum','email'), L10n::t('How to contact the operator via email. (will be displayed obfuscated)')],
'$footer_text' => ['footer_text', t('Footer note'), Config::get('impressum','footer_text'), t('Text for the footer. You can use BBCode here.')], '$footer_text' => ['footer_text', L10n::t('Footer note'), Config::get('impressum','footer_text'), L10n::t('Text for the footer. You can use BBCode here.')],
]); ]);
} }

View file

@ -6,35 +6,39 @@
* Author: Thomas Willingham <https://kakste.com/profile/beardyunixer> * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function infiniteimprobabilitydrive_install() { function infiniteimprobabilitydrive_install()
Addon::registerHook('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); {
Addon::registerHook('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu');
} }
function infiniteimprobabilitydrive_uninstall() { function infiniteimprobabilitydrive_uninstall()
Addon::unregisterHook('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); {
Addon::unregisterHook('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu');
} }
function infiniteimprobabilitydrive_app_menu($a,&$b) { function infiniteimprobabilitydrive_app_menu($a, &$b)
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . t('Infinite Improbability Drive') . '</a></div>'; {
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . L10n::t('Infinite Improbability Drive') . '</a></div>';
} }
function infiniteimprobabilitydrive_module() { function infiniteimprobabilitydrive_module()
return; {
return;
} }
function infiniteimprobabilitydrive_content(&$a) { function infiniteimprobabilitydrive_content(&$a)
$baseurl = $a->get_baseurl() . '/addon/infiniteimprobabilitydrive'; {
$o = ''; $baseurl = $a->get_baseurl() . '/addon/infiniteimprobabilitydrive';
$o = '';
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css"/>'; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css"/>';
$baseurl = $a->get_baseurl(); $baseurl = $a->get_baseurl();
$o .= <<< EOT $o .= <<< EOT
@ -42,9 +46,6 @@ $baseurl = $a->get_baseurl();
<p>Try another destination with the <a href="$baseurl/infiniteimprobabilitydrive">Infinite Improbability Drive</a> <p>Try another destination with the <a href="$baseurl/infiniteimprobabilitydrive">Infinite Improbability Drive</a>
<iframe src ="$baseurl/randprof" height="1200" width="1024"> <iframe src ="$baseurl/randprof" height="1200" width="1024">
EOT; EOT;
return $o; return $o;
} }

View file

@ -8,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function irc_install() { function irc_install() {
@ -37,11 +38,11 @@ function irc_addon_settings(&$a,&$s) {
$t = get_markup_template( "settings.tpl", "addon/irc/" ); $t = get_markup_template( "settings.tpl", "addon/irc/" );
$s .= replace_macros($t, [ $s .= replace_macros($t, [
'$header' => t('IRC Settings'), '$header' => L10n::t('IRC Settings'),
'$info' => t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'), '$info' => L10n::t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$autochans' => [ 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')], '$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')],
'$sitechats' => [ 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ] '$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
]); ]);
@ -57,12 +58,12 @@ function irc_addon_settings_post(&$a,&$b) {
PConfig::set( local_user(), 'irc','autochans',trim($_POST['autochans'])); PConfig::set( local_user(), 'irc','autochans',trim($_POST['autochans']));
PConfig::set( local_user(), 'irc','sitechats',trim($_POST['sitechats'])); PConfig::set( local_user(), 'irc','sitechats',trim($_POST['sitechats']));
/* upid pop-up thing */ /* upid pop-up thing */
info( t('IRC settings saved.') . EOL); info(L10n::t('IRC settings saved.') . EOL);
} }
} }
function irc_app_menu($a,&$b) { function irc_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . t('IRC Chatroom') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="irc">' . L10n::t('IRC Chatroom') . '</a></div>';
} }
@ -90,7 +91,7 @@ function irc_content(&$a) {
$chats = ['friendica','chat','chatback','hottub','ircbar','dateroom','debian']; $chats = ['friendica','chat','chatback','hottub','ircbar','dateroom','debian'];
$a->page['aside'] .= '<div class="widget"><h3>' . t('Popular Channels') . '</h3><ul>'; $a->page['aside'] .= '<div class="widget"><h3>' . L10n::t('Popular Channels') . '</h3><ul>';
foreach($chats as $chat) { foreach($chats as $chat) {
$a->page['aside'] .= '<li><a href="' . $a->get_baseurl() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>'; $a->page['aside'] .= '<li><a href="' . $a->get_baseurl() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
} }
@ -128,7 +129,7 @@ function irc_addon_admin_post (&$a) {
Config::set('irc','autochans',trim($_POST['autochans'])); Config::set('irc','autochans',trim($_POST['autochans']));
Config::set('irc','sitechats',trim($_POST['sitechats'])); Config::set('irc','sitechats',trim($_POST['sitechats']));
/* stupid pop-up thing */ /* stupid pop-up thing */
info( t('IRC settings saved.') . EOL); info(L10n::t('IRC settings saved.') . EOL);
} }
} }
function irc_addon_admin (&$a, &$o) { function irc_addon_admin (&$a, &$o) {
@ -136,8 +137,8 @@ function irc_addon_admin (&$a, &$o) {
$autochans = Config::get('irc','autochans'); /* auto connect chans */ $autochans = Config::get('irc','autochans'); /* auto connect chans */
$t = get_markup_template( "admin.tpl", "addon/irc/" ); $t = get_markup_template( "admin.tpl", "addon/irc/" );
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$autochans' => [ 'autochans', t('Channel(s) to auto connect (comma separated)'), $autochans, t('List of channels that shall automatically connected to when the app is launched.')], '$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')],
'$sitechats' => [ 'sitechats', t('Popular Channels (comma separated)'), $sitechats, t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ] '$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
]); ]);
} }

View file

@ -65,6 +65,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Model\User; use Friendica\Model\User;
@ -326,58 +327,58 @@ function jappixmini_settings(App $a, &$s)
} }
$s .= '<span id="settings_jappixmini_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">'; $s .= '<span id="settings_jappixmini_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">';
$s .= '<h3>' . t('Jappix Mini') . '</h3>'; $s .= '<h3>' . L10n::t('Jappix Mini') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_jappixmini_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_jappixmini_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_jappixmini_expanded\'); openClose(\'settings_jappixmini_inflated\');">';
$s .= '<h3>' . t('Jappix Mini') . '</h3>'; $s .= '<h3>' . L10n::t('Jappix Mini') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<label for="jappixmini-activate">' . t('Activate addon') . '</label>'; $s .= '<label for="jappixmini-activate">' . L10n::t('Activate addon') . '</label>';
$s .= ' <input id="jappixmini-activate" type="checkbox" name="jappixmini-activate" value="1"' . $activate . ' />'; $s .= ' <input id="jappixmini-activate" type="checkbox" name="jappixmini-activate" value="1"' . $activate . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for"jappixmini-dont-insertchat">' . t('Do <em>not</em> insert the Jappixmini Chat-Widget into the webinterface') . '</label>'; $s .= '<label for"jappixmini-dont-insertchat">' . L10n::t('Do <em>not</em> insert the Jappixmini Chat-Widget into the webinterface') . '</label>';
$s .= '<input id="jappixmini-dont-insertchat" type="checkbox" name="jappixmini-dont-insertchat" value="1"' . $insertchat . ' />'; $s .= '<input id="jappixmini-dont-insertchat" type="checkbox" name="jappixmini-dont-insertchat" value="1"' . $insertchat . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-username">' . t('Jabber username') . '</label>'; $s .= '<label for="jappixmini-username">' . L10n::t('Jabber username') . '</label>';
$s .= ' <input id="jappixmini-username" type="text" name="jappixmini-username" value="' . $username . '" />'; $s .= ' <input id="jappixmini-username" type="text" name="jappixmini-username" value="' . $username . '" />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-server">' . t('Jabber server') . '</label>'; $s .= '<label for="jappixmini-server">' . L10n::t('Jabber server') . '</label>';
$s .= ' <input id="jappixmini-server" type="text" name="jappixmini-server" value="' . $server . '" />'; $s .= ' <input id="jappixmini-server" type="text" name="jappixmini-server" value="' . $server . '" />';
$s .= '<br />'; $s .= '<br />';
if ($defaultbosh == "") { if ($defaultbosh == "") {
$s .= '<label for="jappixmini-bosh">' . t('Jabber BOSH host') . '</label>'; $s .= '<label for="jappixmini-bosh">' . L10n::t('Jabber BOSH host') . '</label>';
$s .= ' <input id="jappixmini-bosh" type="text" name="jappixmini-bosh" value="' . $bosh . '" />'; $s .= ' <input id="jappixmini-bosh" type="text" name="jappixmini-bosh" value="' . $bosh . '" />';
$s .= '<br />'; $s .= '<br />';
} }
$s .= '<label for="jappixmini-password">' . t('Jabber password') . '</label>'; $s .= '<label for="jappixmini-password">' . L10n::t('Jabber password') . '</label>';
$s .= ' <input type="hidden" id="jappixmini-password" name="jappixmini-encrypted-password" value="' . $password . '" />'; $s .= ' <input type="hidden" id="jappixmini-password" name="jappixmini-encrypted-password" value="' . $password . '" />';
$s .= ' <input id="jappixmini-clear-password" type="password" value="" onchange="jappixmini_set_password();" />'; $s .= ' <input id="jappixmini-clear-password" type="password" value="" onchange="jappixmini_set_password();" />';
$s .= '<br />'; $s .= '<br />';
$onchange = "document.getElementById('jappixmini-friendica-password').disabled = !this.checked;jappixmini_set_password();"; $onchange = "document.getElementById('jappixmini-friendica-password').disabled = !this.checked;jappixmini_set_password();";
$s .= '<label for="jappixmini-encrypt">' . t('Encrypt Jabber password with Friendica password (recommended)') . '</label>'; $s .= '<label for="jappixmini-encrypt">' . L10n::t('Encrypt Jabber password with Friendica password (recommended)') . '</label>';
$s .= ' <input id="jappixmini-encrypt" type="checkbox" name="jappixmini-encrypt" onchange="' . $onchange . '" value="1"' . $encrypt_checked . ' />'; $s .= ' <input id="jappixmini-encrypt" type="checkbox" name="jappixmini-encrypt" onchange="' . $onchange . '" value="1"' . $encrypt_checked . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-friendica-password">' . t('Friendica password') . '</label>'; $s .= '<label for="jappixmini-friendica-password">' . L10n::t('Friendica password') . '</label>';
$s .= ' <input id="jappixmini-friendica-password" name="jappixmini-friendica-password" type="password" onchange="jappixmini_set_password();" value=""' . $encrypt_disabled . ' />'; $s .= ' <input id="jappixmini-friendica-password" name="jappixmini-friendica-password" type="password" onchange="jappixmini_set_password();" value=""' . $encrypt_disabled . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-autoapprove">' . t('Approve subscription requests from Friendica contacts automatically') . '</label>'; $s .= '<label for="jappixmini-autoapprove">' . L10n::t('Approve subscription requests from Friendica contacts automatically') . '</label>';
$s .= ' <input id="jappixmini-autoapprove" type="checkbox" name="jappixmini-autoapprove" value="1"' . $autoapprove . ' />'; $s .= ' <input id="jappixmini-autoapprove" type="checkbox" name="jappixmini-autoapprove" value="1"' . $autoapprove . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-autosubscribe">' . t('Subscribe to Friendica contacts automatically') . '</label>'; $s .= '<label for="jappixmini-autosubscribe">' . L10n::t('Subscribe to Friendica contacts automatically') . '</label>';
$s .= ' <input id="jappixmini-autosubscribe" type="checkbox" name="jappixmini-autosubscribe" value="1"' . $autosubscribe . ' />'; $s .= ' <input id="jappixmini-autosubscribe" type="checkbox" name="jappixmini-autosubscribe" value="1"' . $autosubscribe . ' />';
$s .= '<br />'; $s .= '<br />';
$s .= '<label for="jappixmini-purge">' . t('Purge internal list of jabber addresses of contacts') . '</label>'; $s .= '<label for="jappixmini-purge">' . L10n::t('Purge internal list of jabber addresses of contacts') . '</label>';
$s .= ' <input id="jappixmini-purge" type="checkbox" name="jappixmini-purge" value="1" />'; $s .= ' <input id="jappixmini-purge" type="checkbox" name="jappixmini-purge" value="1" />';
$s .= '<br />'; $s .= '<br />';
if ($info_text) { if ($info_text) {
$s .= '<br />Configuration help:<p style="margin-left:2em;">' . $info_text . '</p>'; $s .= '<br />Configuration help:<p style="margin-left:2em;">' . $info_text . '</p>';
} }
$s .= '<br />Status:<p style="margin-left:2em;">Addon knows ' . $address_cnt . ' Jabber addresses of ' . $contact_cnt . ' Friendica contacts (takes some time, usually 10 minutes, to update).</p>'; $s .= '<br />Status:<p style="margin-left:2em;">Addon knows ' . $address_cnt . ' Jabber addresses of ' . $contact_cnt . ' Friendica contacts (takes some time, usually 10 minutes, to update).</p>';
$s .= '<input type="submit" name="jappixmini-submit" value="' . t('Save Settings') . '" />'; $s .= '<input type="submit" name="jappixmini-submit" value="' . L10n::t('Save Settings') . '" />';
$s .= ' <input type="button" value="' . t('Add contact') . '" onclick="jappixmini_addon_subscribe();" />'; $s .= ' <input type="button" value="' . L10n::t('Add contact') . '" onclick="jappixmini_addon_subscribe();" />';
$s .= '</div>'; $s .= '</div>';

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: JS Uploader * Name: JS Uploader
* Description: JavaScript photo/image uploader. Uses Valum 'qq' Uploader. * Description: JavaScript photo/image uploader. Uses Valum 'qq' Uploader.
@ -17,7 +16,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function js_upload_install() { function js_upload_install() {
Addon::registerHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form'); Addon::registerHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
@ -42,10 +41,10 @@ function js_upload_form(&$a,&$b) {
$b['addon_text'] .= '<link href="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.css" rel="stylesheet" type="text/css">'; $b['addon_text'] .= '<link href="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.css" rel="stylesheet" type="text/css">';
$b['addon_text'] .= '<script src="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.js" type="text/javascript"></script>'; $b['addon_text'] .= '<script src="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.js" type="text/javascript"></script>';
$upload_msg = t('Upload a file'); $upload_msg = L10n::t('Upload a file');
$drop_msg = t('Drop files here to upload'); $drop_msg = L10n::t('Drop files here to upload');
$cancel = t('Cancel'); $cancel = L10n::t('Cancel');
$failed = t('Failed'); $failed = L10n::t('Failed');
$maximagesize = intval(Config::get('system','maximagesize')); $maximagesize = intval(Config::get('system','maximagesize'));
@ -302,25 +301,25 @@ class qqFileUploader {
function handleUpload(){ function handleUpload(){
if (!$this->file){ if (!$this->file){
return ['error' => t('No files were uploaded.')]; return ['error' => L10n::t('No files were uploaded.')];
} }
$size = $this->file->getSize(); $size = $this->file->getSize();
if ($size == 0) { if ($size == 0) {
return ['error' => t('Uploaded file is empty')]; return ['error' => L10n::t('Uploaded file is empty')];
} }
// if ($size > $this->sizeLimit) { // if ($size > $this->sizeLimit) {
// return array('error' => t('Uploaded file is too large')); // return array('error' => L10n::t('Uploaded file is too large'));
// } // }
$maximagesize = Config::get('system','maximagesize'); $maximagesize = Config::get('system','maximagesize');
if(($maximagesize) && ($size > $maximagesize)) { if(($maximagesize) && ($size > $maximagesize)) {
return ['error' => t('Image exceeds size limit of ') . $maximagesize ]; return ['error' => L10n::t('Image exceeds size limit of ') . $maximagesize ];
} }
@ -331,7 +330,7 @@ class qqFileUploader {
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){ if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
$these = implode(', ', $this->allowedExtensions); $these = implode(', ', $this->allowedExtensions);
return ['error' => t('File has an invalid extension, it should be one of ') . $these . '.']; return ['error' => L10n::t('File has an invalid extension, it should be one of ') . $these . '.'];
} }
if ($this->file->save()){ if ($this->file->save()){
@ -342,7 +341,7 @@ class qqFileUploader {
]; ];
} else { } else {
return [ return [
'error'=> t('Upload was cancelled, or server error encountered'), 'error'=> L10n::t('Upload was cancelled, or server error encountered'),
'path' => $this->file->getPath(), 'path' => $this->file->getPath(),
'filename' => $filename . '.' . $ext 'filename' => $filename . '.' . $ext
]; ];

View file

@ -10,6 +10,7 @@
*"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function krynn_install() { function krynn_install() {
@ -151,23 +152,23 @@ function krynn_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_krynn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">'; $s .= '<span id="settings_krynn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">';
$s .= '<h3>' . t('Krynn') . '</h3>'; $s .= '<h3>' . L10n::t('Krynn') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_krynn_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_krynn_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">';
$s .= '<h3>' . t('Krynn') . '</h3>'; $s .= '<h3>' . L10n::t('Krynn') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Krynn Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Krynn Settings') . '</h3>';
$s .= '<div id="krynn-enable-wrapper">'; $s .= '<div id="krynn-enable-wrapper">';
$s .= '<label id="krynn-enable-label" for="krynn-checkbox">' . t('Enable Krynn Addon') . '</label>'; $s .= '<label id="krynn-enable-label" for="krynn-checkbox">' . L10n::t('Enable Krynn Addon') . '</label>';
$s .= '<input id="krynn-checkbox" type="checkbox" name="krynn" value="1" ' . $checked . '/>'; $s .= '<input id="krynn-checkbox" type="checkbox" name="krynn" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div></div>'; $s .= '</div><div class="clear"></div></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="krynn-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="krynn-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/* /*
* Name: Language Filter * Name: Language Filter
* Version: 0.1 * Version: 0.1
@ -10,6 +9,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
/* Define the hooks we want to use /* Define the hooks we want to use
@ -54,13 +54,13 @@ function langfilter_addon_settings(App $a, &$s)
$t = get_markup_template("settings.tpl", "addon/langfilter/"); $t = get_markup_template("settings.tpl", "addon/langfilter/");
$s .= replace_macros($t, [ $s .= replace_macros($t, [
'$title' => t("Language Filter"), '$title' => L10n::t("Language Filter"),
'$intro' => t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'), '$intro' => L10n::t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'),
'$enabled' => ['langfilter_enable', t('Use the language filter'), $enable_checked, ''], '$enabled' => ['langfilter_enable', L10n::t('Use the language filter'), $enable_checked, ''],
'$languages' => ['langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')], '$languages' => ['langfilter_languages', L10n::t('I speak'), $languages, L10n::t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')],
'$minconfidence' => ['langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')], '$minconfidence' => ['langfilter_minconfidence', L10n::t('Minimum confidence in language detection'), $minconfidence, L10n::t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')],
'$minlength' => ['langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')], '$minlength' => ['langfilter_minlength', L10n::t('Minimum length of message body'), $minlength, L10n::t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')],
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
]); ]);
return; return;
@ -101,7 +101,7 @@ function langfilter_addon_settings_post(App $a, &$b)
} }
PConfig::set(local_user(), 'langfilter', 'minlength', $minlength); PConfig::set(local_user(), 'langfilter', 'minlength', $minlength);
info(t('Language Filter Settings saved.') . EOL); info(L10n::t('Language Filter Settings saved.') . EOL);
} }
} }
@ -178,6 +178,6 @@ function langfilter_prepare_body(App $a, &$b)
if (!$spoken) { if (!$spoken) {
$rnd = random_string(8); $rnd = random_string(8);
$b['html'] = '<div id="langfilter-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'langfilter-' . $rnd . '\'); >' . t('unspoken language %s - Click to open/close', $lang) . '</div><div id="langfilter-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>'; $b['html'] = '<div id="langfilter-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'langfilter-' . $rnd . '\'); >' . L10n::t('unspoken language %s - Click to open/close', $lang) . '</div><div id="langfilter-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
} }
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: Libertree Post Connector * Name: Libertree Post Connector
* Description: Post to libertree accounts * Description: Post to libertree accounts
@ -7,6 +6,7 @@
* Author: Tony Baldwin <https://free-haven.org/u/tony> * Author: Tony Baldwin <https://free-haven.org/u/tony>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function libertree_install() { function libertree_install() {
@ -35,7 +35,7 @@ function libertree_jot_nets(&$a,&$b) {
$ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default'); $ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default');
$selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> '
. t('Post to libertree') . '</div>'; . L10n::t('Post to libertree') . '</div>';
} }
} }
@ -66,36 +66,36 @@ function libertree_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_libertree_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_libertree_expanded\'); openClose(\'settings_libertree_inflated\');">'; $s .= '<span id="settings_libertree_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_libertree_expanded\'); openClose(\'settings_libertree_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/libertree.png" /><h3 class="connector">'. t('libertree Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/libertree.png" /><h3 class="connector">'. L10n::t('libertree Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_libertree_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_libertree_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_libertree_expanded\'); openClose(\'settings_libertree_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_libertree_expanded\'); openClose(\'settings_libertree_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/libertree.png" /><h3 class="connector">'. t('libertree Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/libertree.png" /><h3 class="connector">'. L10n::t('libertree Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="libertree-enable-wrapper">'; $s .= '<div id="libertree-enable-wrapper">';
$s .= '<label id="libertree-enable-label" for="libertree-checkbox">' . t('Enable Libertree Post Addon') . '</label>'; $s .= '<label id="libertree-enable-label" for="libertree-checkbox">' . L10n::t('Enable Libertree Post Addon') . '</label>';
$s .= '<input id="libertree-checkbox" type="checkbox" name="libertree" value="1" ' . $checked . '/>'; $s .= '<input id="libertree-checkbox" type="checkbox" name="libertree" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="libertree-api_token-wrapper">'; $s .= '<div id="libertree-api_token-wrapper">';
$s .= '<label id="libertree-api_token-label" for="libertree-api_token">' . t('Libertree API token') . '</label>'; $s .= '<label id="libertree-api_token-label" for="libertree-api_token">' . L10n::t('Libertree API token') . '</label>';
$s .= '<input id="libertree-api_token" type="text" name="libertree_api_token" value="' . $ltree_api_token . '" />'; $s .= '<input id="libertree-api_token" type="text" name="libertree_api_token" value="' . $ltree_api_token . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="libertree-url-wrapper">'; $s .= '<div id="libertree-url-wrapper">';
$s .= '<label id="libertree-url-label" for="libertree-url">' . t('Libertree site URL') . '</label>'; $s .= '<label id="libertree-url-label" for="libertree-url">' . L10n::t('Libertree site URL') . '</label>';
$s .= '<input id="libertree-url" type="text" name="libertree_url" value="' . $ltree_url . '" />'; $s .= '<input id="libertree-url" type="text" name="libertree_url" value="' . $ltree_url . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="libertree-bydefault-wrapper">'; $s .= '<div id="libertree-bydefault-wrapper">';
$s .= '<label id="libertree-bydefault-label" for="libertree-bydefault">' . t('Post to Libertree by default') . '</label>'; $s .= '<label id="libertree-bydefault-label" for="libertree-bydefault">' . L10n::t('Post to Libertree by default') . '</label>';
$s .= '<input id="libertree-bydefault" type="checkbox" name="libertree_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="libertree-bydefault" type="checkbox" name="libertree_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="libertree-submit" name="libertree-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="libertree-submit" name="libertree-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -7,27 +7,29 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
/** /**
* Installs the addon hook * Installs the addon hook
*/ */
function libravatar_install() { function libravatar_install()
{
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) { if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
info(t('Could NOT install Libravatar successfully.<br>It requires PHP >= 5.3') .EOL); info(L10n::t('Could NOT install Libravatar successfully.<br>It requires PHP >= 5.3') .EOL);
// avoid registering the hook // avoid registering the hook
return false; return false;
} }
Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("registered libravatar in avatar_lookup hook"); logger("registered libravatar in avatar_lookup hook");
} }
/** /**
* Removes the addon hook * Removes the addon hook
*/ */
function libravatar_uninstall() { function libravatar_uninstall()
{
Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup'); Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
logger("unregistered libravatar in avatar_lookup hook"); logger("unregistered libravatar in avatar_lookup hook");
} }
@ -37,16 +39,18 @@ function libravatar_uninstall() {
* @param $a array * @param $a array
* @param &$b array * @param &$b array
*/ */
function libravatar_lookup($a, &$b) { function libravatar_lookup($a, &$b)
{
$default_avatar = Config::get('libravatar', 'default_img'); $default_avatar = Config::get('libravatar', 'default_img');
if (! $default_avatar) { if (! $default_avatar) {
// if not set, look up if there was one from the gravatar addon // if not set, look up if there was one from the gravatar addon
$default_avatar = Config::get('gravatar', 'default_img'); $default_avatar = Config::get('gravatar', 'default_img');
// setting default avatar if nothing configured // setting default avatar if nothing configured
if (! $default_avatar) if (!$default_avatar) {
$default_avatar = 'identicon'; // default image will be a random pattern $default_avatar = 'identicon'; // default image will be a random pattern
} }
}
require_once 'Services/Libravatar.php'; require_once 'Services/Libravatar.php';
$libravatar = new Services_Libravatar(); $libravatar = new Services_Libravatar();
@ -61,29 +65,31 @@ function libravatar_lookup($a, &$b) {
/** /**
* Display admin settings for this addon * Display admin settings for this addon
*/ */
function libravatar_addon_admin (&$a, &$o) { function libravatar_addon_admin(&$a, &$o)
$t = get_markup_template( "admin.tpl", "addon/libravatar" ); {
$t = get_markup_template("admin.tpl", "addon/libravatar");
$default_avatar = Config::get('libravatar', 'default_img'); $default_avatar = Config::get('libravatar', 'default_img');
// set default values for first configuration // set default values for first configuration
if(! $default_avatar) if (!$default_avatar) {
$default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash $default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash
}
// Available options for the select boxes // Available options for the select boxes
$default_avatars = [ $default_avatars = [
'mm' => t('generic profile image'), 'mm' => L10n::t('generic profile image'),
'identicon' => t('random geometric pattern'), 'identicon' => L10n::t('random geometric pattern'),
'monsterid' => t('monster face'), 'monsterid' => L10n::t('monster face'),
'wavatar' => t('computer generated face'), 'wavatar' => L10n::t('computer generated face'),
'retro' => t('retro arcade style face'), 'retro' => L10n::t('retro arcade style face'),
]; ];
// Show warning if PHP version is too old // Show warning if PHP version is too old
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) { if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
$o = '<h5>' .t('Warning') .'</h5><p>'; $o = '<h5>' .L10n::t('Warning') .'</h5><p>';
$o .= sprintf(t('Your PHP version %s is lower than the required PHP >= 5.3.'), PHP_VERSION); $o .= L10n::t('Your PHP version %s is lower than the required PHP >= 5.3.', PHP_VERSION);
$o .= '<br>' .t('This addon is not functional on your server.') .'<p><br>'; $o .= '<br>' .L10n::t('This addon is not functional on your server.') .'<p><br>';
return; return;
} }
@ -92,25 +98,25 @@ function libravatar_addon_admin (&$a, &$o) {
dbesc('gravatar') dbesc('gravatar')
); );
if (count($r)) { if (count($r)) {
$o = '<h5>' .t('Information') .'</h5><p>' .t('Gravatar addon is installed. Please disable the Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>'; $o = '<h5>' .L10n::t('Information') .'</h5><p>' .L10n::t('Gravatar addon is installed. Please disable the Gravatar addon.<br>The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'</p><br><br>';
} }
// output Libravatar settings // output Libravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("libravatarsave") .'">'; $o .= '<input type="hidden" name="form_security_token" value="' .get_form_security_token("libravatarsave") .'">';
$o .= replace_macros( $t, [ $o .= replace_macros( $t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$default_avatar' => ['avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars], '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found. See README'), $default_avatars],
]); ]);
} }
/** /**
* Save admin settings * Save admin settings
*/ */
function libravatar_addon_admin_post (&$a) { function libravatar_addon_admin_post(&$a)
{
check_form_security_token('libravatarrsave'); check_form_security_token('libravatarrsave');
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon'); $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
Config::set('libravatar', 'default_img', $default_avatar); Config::set('libravatar', 'default_img', $default_avatar);
info(t('Libravatar settings updated.') .EOL); info(L10n::t('Libravatar settings updated.') .EOL);
} }
?>

View file

@ -8,6 +8,7 @@
* Author: Cat Gray <https://free-haven.org/profile/catness> * Author: Cat Gray <https://free-haven.org/profile/catness>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function ljpost_install() { function ljpost_install() {
@ -37,7 +38,7 @@ function ljpost_jot_nets(&$a,&$b) {
$lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default'); $lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default');
$selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> '
. t('Post to LiveJournal') . '</div>'; . L10n::t('Post to LiveJournal') . '</div>';
} }
} }
@ -68,30 +69,30 @@ function ljpost_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('LiveJournal Post Settings') . '</h3>'; $s .= '<h3>' . L10n::t('LiveJournal Post Settings') . '</h3>';
$s .= '<div id="ljpost-enable-wrapper">'; $s .= '<div id="ljpost-enable-wrapper">';
$s .= '<label id="ljpost-enable-label" for="ljpost-checkbox">' . t('Enable LiveJournal Post Addon') . '</label>'; $s .= '<label id="ljpost-enable-label" for="ljpost-checkbox">' . L10n::t('Enable LiveJournal Post Addon') . '</label>';
$s .= '<input id="ljpost-checkbox" type="checkbox" name="ljpost" value="1" ' . $checked . '/>'; $s .= '<input id="ljpost-checkbox" type="checkbox" name="ljpost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ljpost-username-wrapper">'; $s .= '<div id="ljpost-username-wrapper">';
$s .= '<label id="ljpost-username-label" for="ljpost-username">' . t('LiveJournal username') . '</label>'; $s .= '<label id="ljpost-username-label" for="ljpost-username">' . L10n::t('LiveJournal username') . '</label>';
$s .= '<input id="ljpost-username" type="text" name="lj_username" value="' . $lj_username . '" />'; $s .= '<input id="ljpost-username" type="text" name="lj_username" value="' . $lj_username . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ljpost-password-wrapper">'; $s .= '<div id="ljpost-password-wrapper">';
$s .= '<label id="ljpost-password-label" for="ljpost-password">' . t('LiveJournal password') . '</label>'; $s .= '<label id="ljpost-password-label" for="ljpost-password">' . L10n::t('LiveJournal password') . '</label>';
$s .= '<input id="ljpost-password" type="password" name="lj_password" value="' . $lj_password . '" />'; $s .= '<input id="ljpost-password" type="password" name="lj_password" value="' . $lj_password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="ljpost-bydefault-wrapper">'; $s .= '<div id="ljpost-bydefault-wrapper">';
$s .= '<label id="ljpost-bydefault-label" for="ljpost-bydefault">' . t('Post to LiveJournal by default') . '</label>'; $s .= '<label id="ljpost-bydefault-label" for="ljpost-bydefault">' . L10n::t('Post to LiveJournal by default') . '</label>';
$s .= '<input id="ljpost-bydefault" type="checkbox" name="lj_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="ljpost-bydefault" type="checkbox" name="lj_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ljpost-submit" name="ljpost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ljpost-submit" name="ljpost-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
@ -70,12 +71,12 @@ function mailstream_addon_admin(&$a,&$o) {
$frommail = Config::get('mailstream', 'frommail'); $frommail = Config::get('mailstream', 'frommail');
$template = get_markup_template('admin.tpl', 'addon/mailstream/'); $template = get_markup_template('admin.tpl', 'addon/mailstream/');
$config = ['frommail', $config = ['frommail',
t('From Address'), L10n::t('From Address'),
$frommail, $frommail,
t('Email address that stream items will appear to be from.')]; L10n::t('Email address that stream items will appear to be from.')];
$o .= replace_macros($template, [ $o .= replace_macros($template, [
'$frommail' => $config, '$frommail' => $config,
'$submit' => t('Save Settings')]); '$submit' => L10n::t('Save Settings')]);
} }
function mailstream_addon_admin_post ($a) { function mailstream_addon_admin_post ($a) {
@ -216,7 +217,7 @@ function mailstream_subject($item) {
break; break;
} }
if ($r[0]['title']) { if ($r[0]['title']) {
return t('Re:') . ' ' . mailstream_decode_subject($r[0]['title']); return L10n::t('Re:') . ' ' . mailstream_decode_subject($r[0]['title']);
} }
$parent = $r[0]['thr-parent']; $parent = $r[0]['thr-parent'];
} }
@ -224,10 +225,10 @@ function mailstream_subject($item) {
intval($item['contact-id']), intval($item['uid'])); intval($item['contact-id']), intval($item['uid']));
$contact = $r[0]; $contact = $r[0];
if ($contact['network'] === 'dfrn') { if ($contact['network'] === 'dfrn') {
return t("Friendica post"); return L10n::t("Friendica post");
} }
if ($contact['network'] === 'dspr') { if ($contact['network'] === 'dspr') {
return t("Diaspora post"); return L10n::t("Diaspora post");
} }
if ($contact['network'] === 'face') { if ($contact['network'] === 'face') {
$text = mailstream_decode_subject($item['body']); $text = mailstream_decode_subject($item['body']);
@ -237,12 +238,12 @@ function mailstream_subject($item) {
return preg_replace('/\\s+/', ' ', $subject); return preg_replace('/\\s+/', ' ', $subject);
} }
if ($contact['network'] === 'feed') { if ($contact['network'] === 'feed') {
return t("Feed item"); return L10n::t("Feed item");
} }
if ($contact['network'] === 'mail') { if ($contact['network'] === 'mail') {
return t("Email"); return L10n::t("Email");
} }
return t("Friendica Item"); return L10n::t("Friendica Item");
} }
function mailstream_send($a, $message_id, $item, $user) { function mailstream_send($a, $message_id, $item, $user) {
@ -286,8 +287,8 @@ function mailstream_send($a, $message_id, $item, $user) {
$item['body'] = bbcode($item['body']); $item['body'] = bbcode($item['body']);
$item['url'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item['id']; $item['url'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item['id'];
$mail->Body = replace_macros($template, [ $mail->Body = replace_macros($template, [
'$upstream' => t('Upstream'), '$upstream' => L10n::t('Upstream'),
'$local' => t('Local'), '$local' => L10n::t('Local'),
'$item' => $item]); '$item' => $item]);
mailstream_html_wrap($mail->Body); mailstream_html_wrap($mail->Body);
if (!$mail->Send()) { if (!$mail->Send()) {
@ -355,25 +356,25 @@ function mailstream_addon_settings(&$a,&$s) {
$s .= replace_macros($template, [ $s .= replace_macros($template, [
'$enabled' => [ '$enabled' => [
'mailstream_enabled', 'mailstream_enabled',
t('Enabled'), L10n::t('Enabled'),
$enabled], $enabled],
'$address' => [ '$address' => [
'mailstream_address', 'mailstream_address',
t('Email Address'), L10n::t('Email Address'),
$address, $address,
t("Leave blank to use your account email address")], L10n::t("Leave blank to use your account email address")],
'$nolikes' => [ '$nolikes' => [
'mailstream_nolikes', 'mailstream_nolikes',
t('Exclude Likes'), L10n::t('Exclude Likes'),
$nolikes, $nolikes,
t("Check this to omit mailing \"Like\" notifications")], L10n::t("Check this to omit mailing \"Like\" notifications")],
'$attachimg' => [ '$attachimg' => [
'mailstream_attachimg', 'mailstream_attachimg',
t('Attach Images'), L10n::t('Attach Images'),
$attachimg, $attachimg,
t("Download images in posts and attach them to the email. Useful for reading email while offline.")], L10n::t("Download images in posts and attach them to the email. Useful for reading email while offline.")],
'$title' => t('Mail Stream Settings'), '$title' => L10n::t('Mail Stream Settings'),
'$submit' => t('Save Settings')]); '$submit' => L10n::t('Save Settings')]);
} }
function mailstream_addon_settings_post($a,$post) { function mailstream_addon_settings_post($a,$post) {

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: MathJax * Name: MathJax
* Description: Addon for Friendika to include MathJax (LaTeX math syntax) * Description: Addon for Friendika to include MathJax (LaTeX math syntax)
@ -9,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function mathjax_install() { function mathjax_install() {
@ -36,18 +36,18 @@ function mathjax_settings (&$a, &$s) {
$use = PConfig::get(local_user(),'mathjax','use'); $use = PConfig::get(local_user(),'mathjax','use');
$usetext = (($use) ? ' checked="checked" ' : ''); $usetext = (($use) ? ' checked="checked" ' : '');
$s .= '<span id="settings_mathjax_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">'; $s .= '<span id="settings_mathjax_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">';
$s .= '<h3>MathJax '.t('Settings').'</h3>'; $s .= '<h3>MathJax '.L10n::t('Settings').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_mathjax_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_mathjax_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_mathjax_expanded\'); openClose(\'settings_mathjax_inflated\');">';
$s .= '<h3>MathJax '.t('Settings').'</h3>'; $s .= '<h3>MathJax '.L10n::t('Settings').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<p>'.t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.').'</p>'; $s .= '<p>'.L10n::t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.').'</p>';
$s .= '<label id="mathjax_label" for="mathjax_use">'.t('Use the MathJax renderer').'</label>'; $s .= '<label id="mathjax_label" for="mathjax_use">'.L10n::t('Use the MathJax renderer').'</label>';
$s .= '<input id="mathjax_use" type="checkbox" name="mathjax_use" value="1"'. $usetext .' />'; $s .= '<input id="mathjax_use" type="checkbox" name="mathjax_use" value="1"'. $usetext .' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="mathjax-submit" name="mathjax-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="mathjax-submit" name="mathjax-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>'; $s .= '</div>';
} }
/* we need to add one JavaScript include command to the html output /* we need to add one JavaScript include command to the html output
@ -71,7 +71,7 @@ function mathjax_page_header($a, &$b) {
function mathjax_addon_admin_post (&$a) { function mathjax_addon_admin_post (&$a) {
$baseurl = ((x($_POST, 'baseurl')) ? trim($_POST['baseurl']) : 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'); $baseurl = ((x($_POST, 'baseurl')) ? trim($_POST['baseurl']) : 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
Config::set('mathjax','baseurl',$baseurl); Config::set('mathjax','baseurl',$baseurl);
info( t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }
function mathjax_addon_admin (&$a, &$o) { function mathjax_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/mathjax/" ); $t = get_markup_template( "admin.tpl", "addon/mathjax/" );
@ -80,7 +80,7 @@ function mathjax_addon_admin (&$a, &$o) {
} }
$o = replace_macros( $t, [ $o = replace_macros( $t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$baseurl' => ['baseurl', t('MathJax Base URL'), Config::get('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')], '$baseurl' => ['baseurl', L10n::t('MathJax Base URL'), Config::get('mathjax','baseurl' ), L10n::t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')],
]); ]);
} }

View file

@ -7,6 +7,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
require_once 'include/datetime.php'; require_once 'include/datetime.php';
@ -23,8 +24,8 @@ function membersince_uninstall()
function membersince_display(&$a, &$b) function membersince_display(&$a, &$b)
{ {
// Works in Vier // Works in Vier
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . t('Member since:') . "</dt>\n<dd>" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</dd>\n</dl>", $b, 1); $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . L10n::t('Member since:') . "</dt>\n<dd>" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
// Trying for Frio // Trying for Frio
//$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . t('Member since:') . "</div><div class=\"profile-entry\">" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</div></div>", $b, 1); //$b = preg_replace('/<\/div>/', "<div id=\"aprofile-membersince\" class=\"aprofile\"><hr class=\"profile-separator\"><div class=\"profile-label-name\">" . L10n::t('Member since:') . "</div><div class=\"profile-entry\">" . datetime_convert('UTC', date_default_timezone_get(), $a->profile['register_date']) . "</div></div>", $b, 1);
} }

View file

@ -7,32 +7,36 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function morepokes_install() { function morepokes_install()
{
Addon::registerHook('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); Addon::registerHook('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs');
} }
function morepokes_uninstall() { function morepokes_uninstall()
{
Addon::unregisterHook('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); Addon::unregisterHook('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs');
} }
function morepokes_poke_verbs($a,&$b) { function morepokes_poke_verbs($a, &$b)
$b['bitchslap'] = ['bitchslapped', t('bitchslap'), t('bitchslapped')]; {
$b['shag'] = ['shag', t('shag'), t('shagged')]; $b['bitchslap'] = ['bitchslapped', L10n::t('bitchslap'), L10n::t('bitchslapped')];
$b['somethingobscenelybiological'] = ['something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to')]; $b['shag'] = ['shag', L10n::t('shag'), L10n::t('shagged')];
$b['newpokefeature'] = ['pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to')]; $b['somethingobscenelybiological'] = ['something obscenely biological', L10n::t('do something obscenely biological to'), L10n::t('did something obscenely biological to')];
$b['declareundyinglove'] = ['declared undying love for', t('declare undying love for'), t('declared undying love for')]; $b['newpokefeature'] = ['pointed out the poke feature to', L10n::t('point out the poke feature to'), L10n::t('pointed out the poke feature to')];
$b['patent'] = ['patented', t('patent'), t('patented')]; $b['declareundyinglove'] = ['declared undying love for', L10n::t('declare undying love for'), L10n::t('declared undying love for')];
$b['strokebeard'] = ['stroked their beard at', t('stroke beard'), t('stroked their beard at')]; $b['patent'] = ['patented', L10n::t('patent'), L10n::t('patented')];
$b['bemoan'] = ['bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to')]; $b['strokebeard'] = ['stroked their beard at', L10n::t('stroke beard'), L10n::t('stroked their beard at')];
$b['hugs'] = ['hugged', t('hug'), t('hugged')]; $b['bemoan'] = ['bemoaned the declining standards of modern secondary and tertiary education to', L10n::t('bemoan the declining standards of modern secondary and tertiary education to'), L10n::t('bemoans the declining standards of modern secondary and tertiary education to')];
$b['kiss'] = ['kissed', t('kiss'), t('kissed')]; $b['hugs'] = ['hugged', L10n::t('hug'), L10n::t('hugged')];
$b['raiseeyebrows'] = ['raised their eyebrows at', t('raise eyebrows at'), t('raised their eyebrows at')]; $b['kiss'] = ['kissed', L10n::t('kiss'), L10n::t('kissed')];
$b['insult'] = ['insulted', t('insult'), t('insulted')]; $b['raiseeyebrows'] = ['raised their eyebrows at', L10n::t('raise eyebrows at'), L10n::t('raised their eyebrows at')];
$b['praise'] = ['praised', t('praise'), t('praised')]; $b['insult'] = ['insulted', L10n::t('insult'), L10n::t('insulted')];
$b['bedubiousof'] = ['was dubious of', t('be dubious of'), t('was dubious of')]; $b['praise'] = ['praised', L10n::t('praise'), L10n::t('praised')];
$b['eat'] = ['ate', t('eat'), t('ate')]; $b['bedubiousof'] = ['was dubious of', L10n::t('be dubious of'), L10n::t('was dubious of')];
$b['giggleandfawn'] = ['giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at')]; $b['eat'] = ['ate', L10n::t('eat'), L10n::t('ate')];
$b['doubt'] = ['doubted', t('doubt'), t('doubted')]; $b['giggleandfawn'] = ['giggled and fawned at', L10n::t('giggle and fawn at'), L10n::t('giggled and fawned at')];
$b['glare'] = ['glared at', t('glare'), t('glared at')]; $b['doubt'] = ['doubted', L10n::t('doubt'), L10n::t('doubted')];
;} $b['glare'] = ['glared at', L10n::t('glare'), L10n::t('glared at')];
}

View file

@ -1,5 +1,4 @@
<?php <?php
/*** /***
* Name: New Member Widget * Name: New Member Widget
* Description: Adds a widget for new members into the sidebar of the network page. The widget will be displayed for the 1st 14days of a account existance and contains a link to the new member page and a free-form text the admin can define. * Description: Adds a widget for new members into the sidebar of the network page. The widget will be displayed for the 1st 14days of a account existance and contains a link to the new member page and a free-form text the admin can define.
@ -7,10 +6,11 @@
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
***/ ***/
require_once('include/bbcode.php'); require_once 'include/bbcode.php';
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function newmemberwidget_install () { function newmemberwidget_install () {
Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init');
@ -23,12 +23,12 @@ function newmemberwidget_uninstall () {
function newmemberwidget_network_mod_init ( $a, $b) { function newmemberwidget_network_mod_init ( $a, $b) {
if (x($_SESSION['new_member'])) { if (x($_SESSION['new_member'])) {
$t = '<div id="newmember_widget" class="widget">'.EOL; $t = '<div id="newmember_widget" class="widget">'.EOL;
$t .= '<h3>'.t('New Member').'</h3>'.EOL; $t .= '<h3>'.L10n::t('New Member').'</h3>'.EOL;
$t .= '<a href="newmember" id="newmemberwidget-tips">' . t('Tips for New Members') . '</a><br />'.EOL; $t .= '<a href="newmember" id="newmemberwidget-tips">' . L10n::t('Tips for New Members') . '</a><br />'.EOL;
if (Config::get('newmemberwidget','linkglobalsupport')==1) if (Config::get('newmemberwidget','linkglobalsupport')==1)
$t .= '<a href="https://forum.friendi.ca/profile/helpers" target="_new">'.t('Global Support Forum').'</a><br />'.EOL; $t .= '<a href="https://forum.friendi.ca/profile/helpers" target="_new">'.L10n::t('Global Support Forum').'</a><br />'.EOL;
if (Config::get('newmemberwidget','linklocalsupport')==1) if (Config::get('newmemberwidget','linklocalsupport')==1)
$t .= '<a href="'.$a->get_baseurl().'/profile/'.Config::get('newmemberwidget','localsupport').'" target="_new">'.t('Local Support Forum').'</a><br />'.EOL; $t .= '<a href="'.$a->get_baseurl().'/profile/'.Config::get('newmemberwidget','localsupport').'" target="_new">'.L10n::t('Local Support Forum').'</a><br />'.EOL;
$ft = Config::get('newmemberwidget','freetext'); $ft = Config::get('newmemberwidget','freetext');
if (!trim($ft)=="") if (!trim($ft)=="")
$t .= '<p>'.bbcode(trim($ft)).'</p>'; $t .= '<p>'.bbcode(trim($ft)).'</p>';
@ -37,25 +37,26 @@ function newmemberwidget_network_mod_init ( $a, $b) {
} }
} }
function newmemberwidget_addon_admin_post( &$a ) { function newmemberwidget_addon_admin_post(&$a)
{
$ft = ((x($_POST, 'freetext')) ? trim($_POST['freetext']) : ""); $ft = ((x($_POST, 'freetext')) ? trim($_POST['freetext']) : "");
$lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : ""); $lsn = ((x($_POST, 'localsupportname')) ? notags(trim($_POST['localsupportname'])) : "");
$gs = intval($_POST['linkglobalsupport']); $gs = intval($_POST['linkglobalsupport']);
$ls = intval($_POST['linklocalsupport']); $ls = intval($_POST['linklocalsupport']);
Config::set ( 'newmemberwidget', 'freetext', trim($ft)); Config::set('newmemberwidget', 'freetext', trim($ft));
Config::set ( 'newmemberwidget', 'linkglobalsupport', $gs); Config::set('newmemberwidget', 'linkglobalsupport', $gs);
Config::set ( 'newmemberwidget', 'linklocalsupport', $ls); Config::set('newmemberwidget', 'linklocalsupport', $ls);
Config::set ( 'newmemberwidget', 'localsupport', trim($lsn)); Config::set('newmemberwidget', 'localsupport', trim($lsn));
} }
function newmemberwidget_addon_admin(&$a, &$o){ function newmemberwidget_addon_admin(&$a, &$o)
$t = get_markup_template('admin.tpl','addon/newmemberwidget'); {
$t = get_markup_template('admin.tpl', 'addon/newmemberwidget');
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$freetext' => [ "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")], '$freetext' => [ "freetext", L10n::t("Message"), Config::get("newmemberwidget", "freetext"), L10n::t("Your message for new members. You can use bbcode here.")],
'$linkglobalsupport' => [ "linkglobalsupport", t('Add a link to global support forum'), Config::get( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"], '$linkglobalsupport' => [ "linkglobalsupport", L10n::t('Add a link to global support forum'), Config::get('newmemberwidget', 'linkglobalsupport'), L10n::t('Should a link to the global support forum be displayed?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"],
'$linklocalsupport' => [ "linklocalsupport", t('Add a link to the local support forum'), Config::get( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')], '$linklocalsupport' => [ "linklocalsupport", L10n::t('Add a link to the local support forum'), Config::get('newmemberwidget', 'linklocalsupport'), L10n::t('If you have a local support forum and want to have a link displayed in the widget, check this box.')],
'$localsupportname' => [ "localsupportname", t('Name of the local support group'), Config::get( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)')], '$localsupportname' => [ "localsupportname", L10n::t('Name of the local support group'), Config::get('newmemberwidget', 'localsupport'), L10n::t('If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)')],
]); ]);
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* *
* Name: Notifyall * Name: Notifyall
@ -8,7 +7,7 @@
* Author: Mike Macgirvin (Inital Author of the hubbwall Addon for the Hubzilla Project) * Author: Mike Macgirvin (Inital Author of the hubbwall Addon for the Hubzilla Project)
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica) * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica)
*/ */
use Friendica\Core\L10n;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
function notifyall_install() { function notifyall_install() {
@ -23,8 +22,7 @@ function notifyall_module() {}
function notifyall_addon_admin(&$a, &$o) { function notifyall_addon_admin(&$a, &$o) {
$o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . z_root() . '/notifyall">' . t('Send email to all members') . '</a></br/>'; $o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . z_root() . '/notifyall">' . L10n::t('Send email to all members') . '</a></br/>';
} }
@ -39,9 +37,9 @@ function notifyall_post(&$a) {
$sitename = $a->config['sitename']; $sitename = $a->config['sitename'];
if (!x($a->config['admin_name'])) if (!x($a->config['admin_name']))
$sender_name = sprintf(t('%s Administrator'), $sitename); $sender_name = L10n::t('%s Administrator', $sitename);
else else
$sender_name = sprintf(t('%1$s, %2$s Administrator'), $a->config['admin_name'], $sitename); $sender_name = L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename);
if (! x($a->config['sender_email'])) if (! x($a->config['sender_email']))
$sender_email = 'noreply@' . $a->get_hostname(); $sender_email = 'noreply@' . $a->get_hostname();
@ -57,7 +55,7 @@ function notifyall_post(&$a) {
// if this is a test, send it only to the admin(s) // if this is a test, send it only to the admin(s)
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f // admin_email might be a comma separated list, but we need "a@b','c@d','e@f
if ( intval($_REQUEST['test'])) { if (intval($_REQUEST['test'])) {
$email = $a->config['admin_email']; $email = $a->config['admin_email'];
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'"; $email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
} }
@ -65,14 +63,12 @@ function notifyall_post(&$a) {
$recips = q("SELECT DISTINCT `email` FROM `user` WHERE `verified` AND NOT `account_removed` AND NOT `account_expired` $sql_extra"); $recips = q("SELECT DISTINCT `email` FROM `user` WHERE `verified` AND NOT `account_removed` AND NOT `account_expired` $sql_extra");
if(! $recips) { if (! $recips) {
notice( t('No recipients found.') . EOL); notice(L10n::t('No recipients found.') . EOL);
return; return;
} }
foreach($recips as $recip) { foreach ($recips as $recip) {
Emailer::send([ Emailer::send([
'fromName' => $sender_name, 'fromName' => $sender_name,
'fromEmail' => $sender_email, 'fromEmail' => $sender_email,
@ -84,24 +80,25 @@ function notifyall_post(&$a) {
]); ]);
} }
notice( t('Emails sent')); notice(L10n::t('Emails sent'));
goaway('admin'); goaway('admin');
} }
function notifyall_content(&$a) { function notifyall_content(&$a)
if(! is_site_admin()) {
if (! is_site_admin()) {
return; return;
}
$title = t('Send email to all members of this Friendica instance.'); $title = L10n::t('Send email to all members of this Friendica instance.');
$o = replace_macros(get_markup_template('notifyall_form.tpl','addon/notifyall/'),[ $o = replace_macros(get_markup_template('notifyall_form.tpl', 'addon/notifyall/'), [
'$title' => $title, '$title' => $title,
'$text' => htmlspecialchars($_REQUEST['text']), '$text' => htmlspecialchars($_REQUEST['text']),
'$subject' => ['subject',t('Message subject'),$_REQUEST['subject'],''], '$subject' => ['subject',L10n::t('Message subject'),$_REQUEST['subject'],''],
'$test' => ['test',t('Test mode (only send to administrator)'), 0,''], '$test' => ['test',L10n::t('Test mode (only send to administrator)'), 0,''],
'$submit' => t('Submit') '$submit' => L10n::t('Submit')
]); ]);
return $o; return $o;
} }

View file

@ -5,32 +5,31 @@
* Version: 1.0 * Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike> * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
* *
*
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function notimeline_install() { function notimeline_install()
{
Addon::registerHook('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings'); Addon::registerHook('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
Addon::registerHook('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post'); Addon::registerHook('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
} }
function notimeline_uninstall()
function notimeline_uninstall() { {
Addon::unregisterHook('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings'); Addon::unregisterHook('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings');
Addon::unregisterHook('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post'); Addon::unregisterHook('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post');
} }
function notimeline_settings_post($a, $post)
function notimeline_settings_post($a,$post) { {
if(! local_user() || (! x($_POST,'notimeline-submit'))) if (!local_user() || (!x($_POST, 'notimeline-submit'))) {
return; return;
}
PConfig::set(local_user(),'system','no_wall_archive_widget',intval($_POST['notimeline'])); PConfig::set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
info( t('No Timeline settings updated.') . EOL); info(L10n::t('No Timeline settings updated.') . EOL);
} }
function notimeline_settings(&$a, &$s) function notimeline_settings(&$a, &$s)
@ -53,13 +52,13 @@ function notimeline_settings(&$a, &$s)
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('No Timeline Settings') . '</h3>'; $s .= '<h3>' . L10n::t('No Timeline Settings') . '</h3>';
$s .= '<div id="notimeline-wrapper">'; $s .= '<div id="notimeline-wrapper">';
$s .= '<label id="notimeline-label" for="notimeline-checkbox">' . t('Disable Archive selector on profile wall') . '</label>'; $s .= '<label id="notimeline-label" for="notimeline-checkbox">' . L10n::t('Disable Archive selector on profile wall') . '</label>';
$s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>'; $s .= '<input id="notimeline-checkbox" type="checkbox" name="notimeline" value="1" ' . $notimeline_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="notimeline-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -7,21 +7,22 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function nsfw_install() { function nsfw_install()
{
Addon::registerHook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body', 10); Addon::registerHook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body', 10);
Addon::registerHook('addon_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings'); Addon::registerHook('addon_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings');
Addon::registerHook('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post'); Addon::registerHook('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post');
} }
function nsfw_uninstall() { function nsfw_uninstall()
{
Addon::unregisterHook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body'); Addon::unregisterHook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body');
Addon::unregisterHook('addon_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings'); Addon::unregisterHook('addon_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings');
Addon::unregisterHook('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post'); Addon::unregisterHook('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post');
} }
// This function isn't perfect and isn't trying to preserve the html structure - it's just a // This function isn't perfect and isn't trying to preserve the html structure - it's just a
@ -29,8 +30,8 @@ function nsfw_uninstall() {
// inside them quite often. We don't need anything fancy, just pull out the data blob so we can // inside them quite often. We don't need anything fancy, just pull out the data blob so we can
// check against the rest of the body. // check against the rest of the body.
function nsfw_extract_photos($body) { function nsfw_extract_photos($body)
{
$new_body = ''; $new_body = '';
$img_start = strpos($body,'src="data:'); $img_start = strpos($body,'src="data:');
@ -75,24 +76,24 @@ function nsfw_addon_settings(&$a,&$s) {
$words = 'nsfw,'; $words = 'nsfw,';
$s .= '<span id="settings_nsfw_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">'; $s .= '<span id="settings_nsfw_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">';
$s .= '<h3>' . t('Not Safe For Work (General Purpose Content Filter)') . '</h3>'; $s .= '<h3>' . L10n::t('Not Safe For Work (General Purpose Content Filter)') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_nsfw_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_nsfw_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">';
$s .= '<h3>' . t('Not Safe For Work (General Purpose Content Filter)') . '</h3>'; $s .= '<h3>' . L10n::t('Not Safe For Work (General Purpose Content Filter)') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="nsfw-wrapper">'; $s .= '<div id="nsfw-wrapper">';
$s .= '<p>' . t ('This addon looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter.') . '</p>'; $s .= '<p>' . L10n::t('This addon looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter.') . '</p>';
$s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . t('Enable Content filter') . ' </label>'; $s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . L10n::t('Enable Content filter') . ' </label>';
$s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />'; $s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="nsfw-label" for="nsfw-words">' . t('Comma separated list of keywords to hide') . ' </label>'; $s .= '<label id="nsfw-label" for="nsfw-words">' . L10n::t('Comma separated list of keywords to hide') . ' </label>';
$s .= '<textarea id="nsfw-words" type="text" name="nsfw-words">' . $words .'</textarea>'; $s .= '<textarea id="nsfw-words" type="text" name="nsfw-words">' . $words .'</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="nsfw-submit" name="nsfw-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="nsfw-submit" name="nsfw-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '<div class="nsfw-desc">' . t('Use /expression/ to provide regular expressions') . '</div></div>'; $s .= '<div class="nsfw-desc">' . L10n::t('Use /expression/ to provide regular expressions') . '</div></div>';
return; return;
@ -108,7 +109,7 @@ function nsfw_addon_settings_post(&$a,&$b) {
$enable = ((x($_POST,'nsfw-enable')) ? intval($_POST['nsfw-enable']) : 0); $enable = ((x($_POST,'nsfw-enable')) ? intval($_POST['nsfw-enable']) : 0);
$disable = 1-$enable; $disable = 1-$enable;
PConfig::set(local_user(),'nsfw','disable', $disable); PConfig::set(local_user(),'nsfw','disable', $disable);
info( t('NSFW Settings saved.') . EOL); info(L10n::t('NSFW Settings saved.') . EOL);
} }
} }
@ -161,8 +162,9 @@ function nsfw_prepare_body(&$a,&$b) {
} }
} }
} }
if($found) {
if ($found) {
$rnd = random_string(8); $rnd = random_string(8);
$b['html'] = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . sprintf( t('%s - Click to open/close'),$word ) . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>'; $b['html'] = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . L10n::t('%s - Click to open/close', $word) . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
} }
} }

View file

@ -6,6 +6,7 @@
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike> * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function numfriends_install() { function numfriends_install() {
@ -39,7 +40,7 @@ function numfriends_settings_post($a,$post) {
return; return;
PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); PConfig::set(local_user(),'system','display_friend_count',intval($_POST['numfriends']));
info( t('Numfriends settings updated.') . EOL); info( L10n::t('Numfriends settings updated.') . EOL);
} }
@ -66,13 +67,13 @@ function numfriends_settings(&$a, &$s)
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Numfriends Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Numfriends Settings') . '</h3>';
$s .= '<div id="numfriends-wrapper">'; $s .= '<div id="numfriends-wrapper">';
$s .= '<label id="numfriends-label" for="numfriends">' . t('How many contacts to display on profile sidebar') . '</label>'; $s .= '<label id="numfriends-label" for="numfriends">' . L10n::t('How many contacts to display on profile sidebar') . '</label>';
$s .= '<input id="numfriends-input" type="text" name="numfriends" value="' . intval($numfriends) . '" ' . '/>'; $s .= '<input id="numfriends-input" type="text" name="numfriends" value="' . intval($numfriends) . '" ' . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="numfriends-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="numfriends-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -11,7 +11,7 @@
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function openstreetmap_install() function openstreetmap_install()
{ {
@ -139,12 +139,12 @@ function openstreetmap_generate_map(&$a, &$b)
$zoom = Config::get('openstreetmap', 'zoom'); $zoom = Config::get('openstreetmap', 'zoom');
if(! $zoom) { if (!$zoom) {
$zoom = 16; $zoom = 16;
} }
$marker = Config::get('openstreetmap', 'marker'); $marker = Config::get('openstreetmap', 'marker');
if(! $marker) { if (!$marker) {
$marker = 0; $marker = 0;
} }
@ -157,38 +157,37 @@ function openstreetmap_generate_map(&$a, &$b)
$b['html'] = '<iframe style="width:100%; height:300px; border:1px solid #ccc" src="' . $tmsserver . '/export/embed.html?bbox=' . ($lon - 0.01) . '%2C' . ($lat - 0.01) . '%2C' . ($lon + 0.01) . '%2C' . ($lat + 0.01) ; $b['html'] = '<iframe style="width:100%; height:300px; border:1px solid #ccc" src="' . $tmsserver . '/export/embed.html?bbox=' . ($lon - 0.01) . '%2C' . ($lat - 0.01) . '%2C' . ($lon + 0.01) . '%2C' . ($lat + 0.01) ;
$b['html'] .= '&amp;layer=mapnik&amp;marker=' . $lat . '%2C' . $lon . '" style="border: 1px solid black"></iframe><br/><small><a href="' . $tmsserver . '/?mlat=' . $lat . '&mlon=' . $lon . '#map=16/' . $lat . '/' . $lon . '">' . (($b['location']) ? escape_tags($b['location']) : t('View Larger')) . '</a></small>'; $b['html'] .= '&amp;layer=mapnik&amp;marker=' . $lat . '%2C' . $lon . '" style="border: 1px solid black"></iframe><br/><small><a href="' . $tmsserver . '/?mlat=' . $lat . '&mlon=' . $lon . '#map=16/' . $lat . '/' . $lon . '">' . (($b['location']) ? escape_tags($b['location']) : L10n::t('View Larger')) . '</a></small>';
logger('generate_map: ' . $b['html'], LOGGER_DATA); logger('generate_map: ' . $b['html'], LOGGER_DATA);
} }
function openstreetmap_addon_admin(&$a, &$o) function openstreetmap_addon_admin(&$a, &$o)
{ {
$t = get_markup_template("admin.tpl", "addon/openstreetmap/"); $t = get_markup_template("admin.tpl", "addon/openstreetmap/");
$tmsserver = Config::get('openstreetmap', 'tmsserver'); $tmsserver = Config::get('openstreetmap', 'tmsserver');
if(! $tmsserver) { if (!$tmsserver) {
$tmsserver = 'http://www.openstreetmap.org'; $tmsserver = 'http://www.openstreetmap.org';
} }
$nomserver = Config::get('openstreetmap', 'nomserver'); $nomserver = Config::get('openstreetmap', 'nomserver');
if(! $nomserver) { if (!$nomserver) {
$nomserver = 'http://nominatim.openstreetmap.org/search.php'; $nomserver = 'http://nominatim.openstreetmap.org/search.php';
} }
$zoom = Config::get('openstreetmap', 'zoom'); $zoom = Config::get('openstreetmap', 'zoom');
if(! $zoom) { if (!$zoom) {
$zoom = 16; $zoom = 16;
} }
$marker = Config::get('openstreetmap', 'marker'); $marker = Config::get('openstreetmap', 'marker');
if(! $marker) { if (!$marker) {
$marker = 0; $marker = 0;
} }
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Submit'), '$submit' => L10n::t('Submit'),
'$tmsserver' => ['tmsserver', t('Tile Server URL'), $tmsserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')], '$tmsserver' => ['tmsserver', L10n::t('Tile Server URL'), $tmsserver, L10n::t('A list of <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')],
'$nomserver' => ['nomserver', t('Nominatim (reverse geocoding) Server URL'), $nomserver, t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')], '$nomserver' => ['nomserver', L10n::t('Nominatim (reverse geocoding) Server URL'), $nomserver, L10n::t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')],
'$zoom' => ['zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest, also depends on tile server)')], '$zoom' => ['zoom', L10n::t('Default zoom'), $zoom, L10n::t('The default zoom level. (1:world, 18:highest, also depends on tile server)')],
'$marker' => ['marker', t('Include marker on map'), $marker, t('Include a marker on the map.')], '$marker' => ['marker', L10n::t('Include marker on map'), $marker, L10n::t('Include a marker on the map.')],
]); ]);
} }
@ -202,5 +201,5 @@ function openstreetmap_addon_admin_post(&$a)
Config::set('openstreetmap', 'nomserver', $urlnom); Config::set('openstreetmap', 'nomserver', $urlnom);
Config::set('openstreetmap', 'zoom', $zoom); Config::set('openstreetmap', 'zoom', $zoom);
Config::set('openstreetmap', 'marker', $marker); Config::set('openstreetmap', 'marker', $marker);
info( t('Settings updated.') . EOL); info(L10n::t('Settings updated.') . EOL);
} }

View file

@ -9,6 +9,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function pageheader_install() { function pageheader_install() {
Addon::registerHook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch'); Addon::registerHook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch');
@ -48,13 +49,13 @@ function pageheader_addon_settings(&$a,&$s) {
$words = ''; $words = '';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('"pageheader" Settings') . '</h3>'; $s .= '<h3>' . L10n::t('"pageheader" Settings') . '</h3>';
$s .= '<div id="pageheader-wrapper">'; $s .= '<div id="pageheader-wrapper">';
$s .= '<label id="pageheader-label" for="pageheader-words">' . t('Message to display on every page on this server (or put a pageheader.html file in your docroot)') . ' </label>'; $s .= '<label id="pageheader-label" for="pageheader-words">' . L10n::t('Message to display on every page on this server (or put a pageheader.html file in your docroot)') . ' </label>';
$s .= '<textarea id="pageheader-words" type="text" name="pageheader-words">' . $words . '</textarea>'; $s .= '<textarea id="pageheader-words" type="text" name="pageheader-words">' . $words . '</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pageheader-submit" name="pageheader-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pageheader-submit" name="pageheader-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
return; return;
@ -67,7 +68,7 @@ function pageheader_addon_settings_post(&$a,&$b) {
if($_POST['pageheader-submit']) { if($_POST['pageheader-submit']) {
Config::set('pageheader','text',trim(strip_tags($_POST['pageheader-words']))); Config::set('pageheader','text',trim(strip_tags($_POST['pageheader-words'])));
info( t('pageheader Settings saved.') . EOL); info(L10n::t('pageheader Settings saved.') . EOL);
} }
} }

View file

@ -31,6 +31,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function piwik_install() { function piwik_install() {
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics'); Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
@ -78,21 +79,21 @@ function piwik_analytics($a,&$b) {
*/ */
if ($optout) { if ($optout) {
$b .= "<div id='piwik-optout-link'>"; $b .= "<div id='piwik-optout-link'>";
$b .= t("This website is tracked using the <a href='http://www.piwik.org'>Piwik</a> analytics tool."); $b .= L10n::t("This website is tracked using the <a href='http://www.piwik.org'>Piwik</a> analytics tool.");
$b .= " "; $b .= " ";
$the_url = "http://".$baseurl ."index.php?module=CoreAdminHome&action=optOut"; $the_url = "http://".$baseurl ."index.php?module=CoreAdminHome&action=optOut";
$b .= sprintf(t("If you do not want that your visits are logged in this way you <a href='%s'>can set a cookie to prevent Piwik from tracking further visits of the site</a> (opt-out)."), $the_url); $b .= L10n::t("If you do not want that your visits are logged in this way you <a href='%s'>can set a cookie to prevent Piwik from tracking further visits of the site</a> (opt-out).", $the_url);
$b .= "</div>"; $b .= "</div>";
} }
} }
function piwik_addon_admin (&$a, &$o) { function piwik_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/piwik/" ); $t = get_markup_template( "admin.tpl", "addon/piwik/" );
$o = replace_macros( $t, [ $o = replace_macros( $t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$piwikbaseurl' => ['baseurl', t('Piwik Base URL'), Config::get('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')], '$piwikbaseurl' => ['baseurl', L10n::t('Piwik Base URL'), Config::get('piwik','baseurl' ), L10n::t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')],
'$siteid' => ['siteid', t('Site ID'), Config::get('piwik','siteid' ), ''], '$siteid' => ['siteid', L10n::t('Site ID'), Config::get('piwik','siteid' ), ''],
'$optout' => ['optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''], '$optout' => ['optout', L10n::t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''],
'$async' => ['async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''], '$async' => ['async', L10n::t('Asynchronous tracking'), Config::get('piwik','async' ), ''],
]); ]);
} }
function piwik_addon_admin_post (&$a) { function piwik_addon_admin_post (&$a) {
@ -104,5 +105,5 @@ function piwik_addon_admin_post (&$a) {
Config::set('piwik', 'siteid', $id); Config::set('piwik', 'siteid', $id);
Config::set('piwik', 'optout', $optout); Config::set('piwik', 'optout', $optout);
Config::set('piwik', 'async', $async); Config::set('piwik', 'async', $async);
info( t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }

View file

@ -7,6 +7,7 @@
* Author: Tony Baldwin <https://free-haven.org/profile/tony> * Author: Tony Baldwin <https://free-haven.org/profile/tony>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function planets_install() { function planets_install() {
@ -148,22 +149,22 @@ function planets_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_planets_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">'; $s .= '<span id="settings_planets_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">';
$s .= '<h3>' . t('Planets') . '</h3>'; $s .= '<h3>' . L10n::t('Planets') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_planets_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_planets_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">';
$s .= '<h3>' . t('Planets') . '</h3>'; $s .= '<h3>' . L10n::t('Planets') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Planets Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Planets Settings') . '</h3>';
$s .= '<div id="planets-enable-wrapper">'; $s .= '<div id="planets-enable-wrapper">';
$s .= '<label id="planets-enable-label" for="planets-checkbox">' . t('Enable Planets Addon') . '</label>'; $s .= '<label id="planets-enable-label" for="planets-checkbox">' . L10n::t('Enable Planets Addon') . '</label>';
$s .= '<input id="planets-checkbox" type="checkbox" name="planets" value="1" ' . $checked . '/>'; $s .= '<input id="planets-checkbox" type="checkbox" name="planets" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div></div>'; $s .= '</div><div class="clear"></div></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="planets-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="planets-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -9,6 +9,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function pledgie_install() { function pledgie_install() {
Addon::registerHook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); Addon::registerHook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active');
@ -41,18 +42,18 @@ function pledgie_addon_settings(&$a,&$s) {
$describe = ''; $describe = '';
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('"pledgie" Settings') . '</h3>'; $s .= '<h3>' . L10n::t('"pledgie" Settings') . '</h3>';
$s .= '<div id="pledgie-wrapper">'; $s .= '<div id="pledgie-wrapper">';
$s .= '<label id="pledgie-label" for="pledgie-campaign">' . t('Pledgie campaign number to use for donations') . ' </label>'; $s .= '<label id="pledgie-label" for="pledgie-campaign">' . L10n::t('Pledgie campaign number to use for donations') . ' </label>';
$s .= '<input id="pledgie-campaign" type="text" name="pledgie-campaign" value="' . $campaign . '">'; $s .= '<input id="pledgie-campaign" type="text" name="pledgie-campaign" value="' . $campaign . '">';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pledgie-wrapper">'; $s .= '<div id="pledgie-wrapper">';
$s .= '<label id="pledgie-label" for="pledgie-describe">' . t('Description of the Pledgie campaign') . ' </label>'; $s .= '<label id="pledgie-label" for="pledgie-describe">' . L10n::t('Description of the Pledgie campaign') . ' </label>';
$s .= '<input id="pledgie-describe" type="text" name="pledgie-describe" value="' . $describe . '">'; $s .= '<input id="pledgie-describe" type="text" name="pledgie-describe" value="' . $describe . '">';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pledgie-submit" name="pledgie-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pledgie-submit" name="pledgie-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
return; return;
} }
@ -65,7 +66,7 @@ function pledgie_addon_settings_post(&$a,&$b) {
if($_POST['pledgie-submit']) { if($_POST['pledgie-submit']) {
Config::set('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe']))); Config::set('pledgie-describe','text',trim(strip_tags($_POST['pledgie-describe'])));
Config::set('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign']))); Config::set('pledgie-campaign','text',trim(strip_tags($_POST['pledgie-campaign'])));
info( t('pledgie Settings saved.') . EOL); info(L10n::t('pledgie Settings saved.') . EOL);
} }
} }

View file

@ -7,14 +7,14 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Model\User; use Friendica\Model\User;
function public_server_install() { function public_server_install() {
Addon::registerHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account'); Addon::registerHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
Addon::registerHook('cron', 'addon/public_server/public_server.php', 'public_server_cron'); Addon::registerHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
Addon::registerHook('enotify','addon/public_server/public_server.php', 'public_server_enotify'); Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
Addon::registerHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); Addon::registerHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
} }
@ -23,7 +23,7 @@ function public_server_uninstall() {
Addon::unregisterHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account'); Addon::unregisterHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
Addon::unregisterHook('cron', 'addon/public_server/public_server.php', 'public_server_cron'); Addon::unregisterHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
Addon::unregisterHook('enotify','addon/public_server/public_server.php', 'public_server_enotify'); Addon::unregisterHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
} }
@ -61,7 +61,7 @@ function public_server_cron($a,$b) {
'language' => $rr['language'], 'language' => $rr['language'],
'to_name' => $rr['username'], 'to_name' => $rr['username'],
'to_email' => $rr['email'], 'to_email' => $rr['email'],
'source_name' => t('Administrator'), 'source_name' => L10n::t('Administrator'),
'source_link' => $a->get_baseurl(), 'source_link' => $a->get_baseurl(),
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg', 'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
]); ]);
@ -125,9 +125,9 @@ function public_server_enotify(&$a, &$b) {
if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') { && x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') {
$b['itemlink'] = $a->get_baseurl(); $b['itemlink'] = $a->get_baseurl();
$b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('system','sitename')); $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
$b['subject'] = t('Your Friendica account is about to expire.'); $b['subject'] = L10n::t('Your Friendica account is about to expire.');
$b['body'] = sprintf( t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days"), $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]"); $b['body'] = L10n::t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]");
} }
} }
@ -155,15 +155,15 @@ function public_server_addon_admin_post ( &$a ) {
Config::set( 'public_server','flagusers',$flagusers); Config::set( 'public_server','flagusers',$flagusers);
Config::set( 'public_server','flagposts',$flagposts ); Config::set( 'public_server','flagposts',$flagposts );
Config::set( 'public_server','flagpostsexpire',$flagpostsexpire ); Config::set( 'public_server','flagpostsexpire',$flagpostsexpire );
info( t('Settings saved').EOL ); info(L10n::t('Settings saved').EOL );
} }
function public_server_addon_admin ( &$a, &$o) { function public_server_addon_admin ( &$a, &$o) {
$token = get_form_security_token("publicserver"); $token = get_form_security_token("publicserver");
$t = get_markup_template( "admin.tpl", "addon/public_server"); $t = get_markup_template( "admin.tpl", "addon/public_server");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$form_security_token' => $token, '$form_security_token' => $token,
'$infotext' => t('Set any of these options to 0 to deactivate it.'), '$infotext' => L10n::t('Set any of these options to 0 to deactivate it.'),
'$expiredays' => [ "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "], '$expiredays' => [ "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "],
'$expireposts' => [ "expireposts", "Expire Posts", intval(Config::get('public_server','expireposts')), "Set the default days for posts to expire here"], '$expireposts' => [ "expireposts", "Expire Posts", intval(Config::get('public_server','expireposts')), "Set the default days for posts to expire here"],
'$nologin' => [ "nologin", "No Login", intval(Config::get('public_server','nologin')), "Remove users who have never logged in after nologin days "], '$nologin' => [ "nologin", "No Login", intval(Config::get('public_server','nologin')), "Remove users who have never logged in after nologin days "],
@ -172,4 +172,3 @@ function public_server_addon_admin ( &$a, &$o) {
'$flagpostsexpire' => [ "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))], '$flagpostsexpire' => [ "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))],
]); ]);
} }

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -50,7 +51,7 @@ function pumpio_module() {}
function pumpio_content(&$a) { function pumpio_content(&$a) {
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }
@ -146,7 +147,7 @@ function pumpio_connect(&$a) {
if (($consumer_key == "") || ($consumer_secret == "")) { if (($consumer_key == "") || ($consumer_secret == "")) {
logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname)); logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
$o .= sprintf(t("Unable to register the client at the pump.io server '%s'."), $hostname); $o .= L10n::t("Unable to register the client at the pump.io server '%s'.", $hostname);
return($o); return($o);
} }
@ -186,8 +187,8 @@ function pumpio_connect(&$a) {
if($success) { if($success) {
logger("pumpio_connect: authenticated"); logger("pumpio_connect: authenticated");
$o .= t("You are now authenticated to pumpio."); $o .= L10n::t("You are now authenticated to pumpio.");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>'; $o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
} else { } else {
logger("pumpio_connect: could not connect"); logger("pumpio_connect: could not connect");
$o = 'Could not connect to pumpio. Refresh the page or try again later.'; $o = 'Could not connect to pumpio. Refresh the page or try again later.';
@ -205,7 +206,7 @@ function pumpio_jot_nets(&$a,&$b) {
$pumpio_defpost = PConfig::get(local_user(),'pumpio','post_by_default'); $pumpio_defpost = PConfig::get(local_user(),'pumpio','post_by_default');
$selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> '
. t('Post to pumpio') . '</div>'; . L10n::t('Post to pumpio') . '</div>';
} }
} }
@ -243,20 +244,20 @@ function pumpio_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_pumpio_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_pumpio_expanded\'); openClose(\'settings_pumpio_inflated\');">'; $s .= '<span id="settings_pumpio_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_pumpio_expanded\'); openClose(\'settings_pumpio_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/pumpio.png" /><h3 class="connector">'. t('Pump.io Import/Export/Mirror').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/pumpio.png" /><h3 class="connector">'. L10n::t('Pump.io Import/Export/Mirror').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_pumpio_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_pumpio_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_pumpio_expanded\'); openClose(\'settings_pumpio_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_pumpio_expanded\'); openClose(\'settings_pumpio_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/pumpio.png" /><h3 class="connector">'. t('Pump.io Import/Export/Mirror').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/pumpio.png" /><h3 class="connector">'. L10n::t('Pump.io Import/Export/Mirror').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="pumpio-username-wrapper">'; $s .= '<div id="pumpio-username-wrapper">';
$s .= '<label id="pumpio-username-label" for="pumpio-username">'.t('pump.io username (without the servername)').'</label>'; $s .= '<label id="pumpio-username-label" for="pumpio-username">'.L10n::t('pump.io username (without the servername)').'</label>';
$s .= '<input id="pumpio-username" type="text" name="pumpio_user" value="'.$username.'" />'; $s .= '<input id="pumpio-username" type="text" name="pumpio_user" value="'.$username.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-servername-wrapper">'; $s .= '<div id="pumpio-servername-wrapper">';
$s .= '<label id="pumpio-servername-label" for="pumpio-servername">'.t('pump.io servername (without "http://" or "https://" )').'</label>'; $s .= '<label id="pumpio-servername-label" for="pumpio-servername">'.L10n::t('pump.io servername (without "http://" or "https://" )').'</label>';
$s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />'; $s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -268,36 +269,36 @@ function pumpio_settings(&$a,&$s) {
$s .= '<div id="pumpio-password-wrapper">'; $s .= '<div id="pumpio-password-wrapper">';
if (($oauth_token == "") || ($oauth_token_secret == "")) { if (($oauth_token == "") || ($oauth_token_secret == "")) {
$s .= '<div id="pumpio-authenticate-wrapper">'; $s .= '<div id="pumpio-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("Authenticate your pump.io connection").'</a>'; $s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.L10n::t("Authenticate your pump.io connection").'</a>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
} else { } else {
$s .= '<div id="pumpio-import-wrapper">'; $s .= '<div id="pumpio-import-wrapper">';
$s .= '<label id="pumpio-import-label" for="pumpio-import">' . t('Import the remote timeline') . '</label>'; $s .= '<label id="pumpio-import-label" for="pumpio-import">' . L10n::t('Import the remote timeline') . '</label>';
$s .= '<input id="pumpio-import" type="checkbox" name="pumpio_import" value="1" ' . $import_checked . '/>'; $s .= '<input id="pumpio-import" type="checkbox" name="pumpio_import" value="1" ' . $import_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-enable-wrapper">'; $s .= '<div id="pumpio-enable-wrapper">';
$s .= '<label id="pumpio-enable-label" for="pumpio-checkbox">' . t('Enable pump.io Post Addon') . '</label>'; $s .= '<label id="pumpio-enable-label" for="pumpio-checkbox">' . L10n::t('Enable pump.io Post Addon') . '</label>';
$s .= '<input id="pumpio-checkbox" type="checkbox" name="pumpio" value="1" ' . $checked . '/>'; $s .= '<input id="pumpio-checkbox" type="checkbox" name="pumpio" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-bydefault-wrapper">'; $s .= '<div id="pumpio-bydefault-wrapper">';
$s .= '<label id="pumpio-bydefault-label" for="pumpio-bydefault">' . t('Post to pump.io by default') . '</label>'; $s .= '<label id="pumpio-bydefault-label" for="pumpio-bydefault">' . L10n::t('Post to pump.io by default') . '</label>';
$s .= '<input id="pumpio-bydefault" type="checkbox" name="pumpio_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="pumpio-bydefault" type="checkbox" name="pumpio_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-public-wrapper">'; $s .= '<div id="pumpio-public-wrapper">';
$s .= '<label id="pumpio-public-label" for="pumpio-public">' . t('Should posts be public?') . '</label>'; $s .= '<label id="pumpio-public-label" for="pumpio-public">' . L10n::t('Should posts be public?') . '</label>';
$s .= '<input id="pumpio-public" type="checkbox" name="pumpio_public" value="1" ' . $public_checked . '/>'; $s .= '<input id="pumpio-public" type="checkbox" name="pumpio_public" value="1" ' . $public_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-mirror-wrapper">'; $s .= '<div id="pumpio-mirror-wrapper">';
$s .= '<label id="pumpio-mirror-label" for="pumpio-mirror">' . t('Mirror all public posts') . '</label>'; $s .= '<label id="pumpio-mirror-label" for="pumpio-mirror">' . L10n::t('Mirror all public posts') . '</label>';
$s .= '<input id="pumpio-mirror" type="checkbox" name="pumpio_mirror" value="1" ' . $mirror_checked . '/>'; $s .= '<input id="pumpio-mirror" type="checkbox" name="pumpio_mirror" value="1" ' . $mirror_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="pumpio-delete-wrapper">'; $s .= '<div id="pumpio-delete-wrapper">';
$s .= '<label id="pumpio-delete-label" for="pumpio-delete">' . t('Check to delete this preset') . '</label>'; $s .= '<label id="pumpio-delete-label" for="pumpio-delete">' . L10n::t('Check to delete this preset') . '</label>';
$s .= '<input id="pumpio-delete" type="checkbox" name="pumpio_delete" value="1" />'; $s .= '<input id="pumpio-delete" type="checkbox" name="pumpio_delete" value="1" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
} }
@ -307,7 +308,7 @@ function pumpio_settings(&$a,&$s) {
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pumpio-submit" name="pumpio-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="pumpio-submit" name="pumpio-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
@ -554,7 +555,7 @@ function pumpio_send(&$a,&$b) {
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
Queue::add($a->contact, NETWORK_PUMPIO, $s); Queue::add($a->contact, NETWORK_PUMPIO, $s);
notice(t('Pump.io post failed. Queued for retry.').EOL); notice(L10n::t('Pump.io post failed. Queued for retry.').EOL);
} }
} }
} }
@ -630,7 +631,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
$s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]); $s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
Queue::add($a->contact, NETWORK_PUMPIO, $s); Queue::add($a->contact, NETWORK_PUMPIO, $s);
notice(t('Pump.io like failed. Queued for retry.').EOL); notice(L10n::t('Pump.io like failed. Queued for retry.').EOL);
} }
} }
@ -719,7 +720,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
// get the application name for the pump.io app // get the application name for the pump.io app
// 1st try personal config, then system config and fallback to the // 1st try personal config, then system config and fallback to the
// hostname of the node if neither one is set. // hostname of the node if neither one is set.
$application_name = PConfig::get( $uid, 'pumpio', 'application_name'); $application_name = PConfig::get($uid, 'pumpio', 'application_name');
if ($application_name == "") if ($application_name == "")
$application_name = Config::get('pumpio', 'application_name'); $application_name = Config::get('pumpio', 'application_name');
if ($application_name == "") if ($application_name == "")
@ -963,11 +964,11 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
$author = '[url=' . $likedata['author-link'] . ']' . $likedata['author-name'] . '[/url]'; $author = '[url=' . $likedata['author-link'] . ']' . $likedata['author-name'] . '[/url]';
$objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]'; $objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]';
$post_type = t('status'); $post_type = L10n::t('status');
$plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]'; $plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]';
$likedata['object-type'] = ACTIVITY_OBJ_NOTE; $likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedata['body'] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink); $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' . $likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>'; '<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';

View file

@ -1,6 +1,4 @@
<?php <?php
/** /**
* Name: Quick Comment * Name: Quick Comment
* Description: Two click comments * Description: Two click comments
@ -20,6 +18,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function qcomment_install() { function qcomment_install() {
@ -28,17 +27,12 @@ function qcomment_install() {
} }
function qcomment_uninstall() { function qcomment_uninstall() {
Addon::unregisterHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); Addon::unregisterHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings');
Addon::unregisterHook('addon_settings_post', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings_post'); Addon::unregisterHook('addon_settings_post', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings_post');
} }
function qcomment_addon_settings(&$a, &$s) function qcomment_addon_settings(&$a, &$s)
{ {
if (! local_user()) { if (! local_user()) {
@ -49,17 +43,17 @@ function qcomment_addon_settings(&$a, &$s)
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/qcomment/qcomment.css' . '" media="all" />' . "\r\n"; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/qcomment/qcomment.css' . '" media="all" />' . "\r\n";
$words = PConfig::get(local_user(), 'qcomment', 'words', t(':-)') . "\n" . t(':-(') . "\n" . t('lol')); $words = PConfig::get(local_user(), 'qcomment', 'words', L10n::t(':-)') . "\n" . L10n::t(':-(') . "\n" . L10n::t('lol'));
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Quick Comment Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Quick Comment Settings') . '</h3>';
$s .= '<div id="qcomment-wrapper">'; $s .= '<div id="qcomment-wrapper">';
$s .= '<div id="qcomment-desc">' . t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '</div>'; $s .= '<div id="qcomment-desc">' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '</div>';
$s .= '<label id="qcomment-label" for="qcomment-words">' . t('Enter quick comments, one per line') . ' </label>'; $s .= '<label id="qcomment-label" for="qcomment-words">' . L10n::t('Enter quick comments, one per line') . ' </label>';
$s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(unxmlify($words)) . '</textarea>'; $s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(unxmlify($words)) . '</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="qcomment-submit" name="qcomment-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="qcomment-submit" name="qcomment-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>'; $s .= '</div>';
return; return;
@ -72,7 +66,6 @@ function qcomment_addon_settings_post(&$a,&$b) {
if($_POST['qcomment-submit']) { if($_POST['qcomment-submit']) {
PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words'])); PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words']));
info( t('Quick Comment settings saved.') . EOL); info(L10n::t('Quick Comment settings saved.') . EOL);
} }
} }

View file

@ -19,6 +19,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function randplace_install() { function randplace_install() {
@ -167,14 +168,14 @@ function randplace_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('Randplace Settings') . '</h3>'; $s .= '<h3>' . L10n::t('Randplace Settings') . '</h3>';
$s .= '<div id="randplace-enable-wrapper">'; $s .= '<div id="randplace-enable-wrapper">';
$s .= '<label id="randplace-enable-label" for="randplace-checkbox">' . t('Enable Randplace Addon') . '</label>'; $s .= '<label id="randplace-enable-label" for="randplace-checkbox">' . L10n::t('Enable Randplace Addon') . '</label>';
$s .= '<input id="randplace-checkbox" type="checkbox" name="randplace" value="1" ' . $checked . '/>'; $s .= '<input id="randplace-checkbox" type="checkbox" name="randplace" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="randplace-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="randplace-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -8,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function remote_permissions_install() { function remote_permissions_install() {
@ -44,10 +45,10 @@ function remote_permissions_settings(&$a,&$o) {
// $t = file_get_contents("addon/remote_permissions/settings.tpl" ); // $t = file_get_contents("addon/remote_permissions/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/remote_permissions/" ); $t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
$o .= replace_macros($t, [ $o .= replace_macros($t, [
'$remote_perms_title' => t('Remote Permissions Settings'), '$remote_perms_title' => L10n::t('Remote Permissions Settings'),
'$remote_perms_label' => t('Allow recipients of your private posts to see the other recipients of the posts'), '$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''), '$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
'$submit' => t('Save Settings') '$submit' => L10n::t('Save Settings')
]); ]);
} }
@ -57,7 +58,7 @@ function remote_permissions_settings_post($a,$post) {
return; return;
PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms'])); PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
info( t('Remote Permissions settings updated.') . EOL); info(L10n::t('Remote Permissions settings updated.') . EOL);
} }
function remote_permissions_content($a, $item_copy) { function remote_permissions_content($a, $item_copy) {
@ -123,7 +124,7 @@ function remote_permissions_content($a, $item_copy) {
$deny_users = expand_acl($item['deny_cid']); $deny_users = expand_acl($item['deny_cid']);
$deny_groups = expand_acl($item['deny_gid']); $deny_groups = expand_acl($item['deny_gid']);
$o = t('Visible to:') . '<br />'; $o = L10n::t('Visible to:') . '<br />';
$allow = []; $allow = [];
$deny = []; $deny = [];
@ -177,7 +178,7 @@ function remote_permissions_content($a, $item_copy) {
if(! $r) if(! $r)
return; return;
$o = t('Visible to') . ' (' . t('may only be a partial list') . '):<br />'; $o = L10n::t('Visible to') . ' (' . L10n::t('may only be a partial list') . '):<br />';
foreach($r as $rr) foreach($r as $rr)
$allow_names[] = $rr['username']; $allow_names[] = $rr['username'];
@ -195,15 +196,14 @@ function remote_permissions_content($a, $item_copy) {
function remote_permissions_addon_admin(&$a, &$o){ function remote_permissions_addon_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" ); $t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$global' => ['remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1], '$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0] '$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
]); ]);
} }
function remote_permissions_addon_admin_post(&$a){ function remote_permissions_addon_admin_post(&$a){
$choice = ((x($_POST,'remotepermschoice')) ? notags(trim($_POST['remotepermschoice'])) : ''); $choice = ((x($_POST,'remotepermschoice')) ? notags(trim($_POST['remotepermschoice'])) : '');
Config::set('remote_perms','global',($choice == 1 ? 1 : 0)); Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
info( t('Settings updated.'). EOL ); info(L10n::t('Settings updated.'). EOL);
} }

View file

@ -8,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function rendertime_install() { function rendertime_install() {
Addon::registerHook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); Addon::registerHook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end');
@ -30,7 +31,7 @@ function rendertime_page_end(&$a, &$o) {
$ignored = in_array($a->module, $ignored_modules); $ignored = in_array($a->module, $ignored_modules);
if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
$o = $o.'<div class="renderinfo">'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"), $o = $o.'<div class="renderinfo">'. L10n::t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s",
round($a->performance["database"] - $a->performance["database_write"], 3), round($a->performance["database"] - $a->performance["database_write"], 3),
round($a->performance["database_write"], 3), round($a->performance["database_write"], 3),
round($a->performance["network"], 2), round($a->performance["network"], 2),

View file

@ -8,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
@ -62,11 +63,11 @@ function securemail_settings(App &$a, &$s){
$t = get_markup_template('admin.tpl', 'addon/securemail/'); $t = get_markup_template('admin.tpl', 'addon/securemail/');
$s .= replace_macros($t, [ $s .= replace_macros($t, [
'$title' => t('"Secure Mail" Settings'), '$title' => L10n::t('"Secure Mail" Settings'),
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$test' => t('Save and send test'), //NOTE: update also in 'post' '$test' => L10n::t('Save and send test'), //NOTE: update also in 'post'
'$enable' => ['securemail-enable', t('Enable Secure Mail'), $enable, ''], '$enable' => ['securemail-enable', L10n::t('Enable Secure Mail'), $enable, ''],
'$publickey' => ['securemail-pkey', t('Public key'), $publickey, t('Your public PGP key, ascii armored format'), 'rows="10"'] '$publickey' => ['securemail-pkey', L10n::t('Public key'), $publickey, L10n::t('Your public PGP key, ascii armored format'), 'rows="10"']
]); ]);
} }
@ -90,9 +91,9 @@ function securemail_settings_post(App &$a, array &$b){
PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey'])); PConfig::set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
$enable = ((x($_POST, 'securemail-enable')) ? 1 : 0); $enable = ((x($_POST, 'securemail-enable')) ? 1 : 0);
PConfig::set(local_user(), 'securemail', 'enable', $enable); PConfig::set(local_user(), 'securemail', 'enable', $enable);
info(t('Secure Mail Settings saved.') . EOL); info(L10n::t('Secure Mail Settings saved.') . EOL);
if ($_POST['securemail-submit'] == t('Save and send test')) { if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
$sitename = $a->config['sitename']; $sitename = $a->config['sitename'];
$hostname = $a->get_hostname(); $hostname = $a->get_hostname();
@ -127,9 +128,9 @@ function securemail_settings_post(App &$a, array &$b){
PConfig::set(local_user(), 'securemail', 'enable', $enable); PConfig::set(local_user(), 'securemail', 'enable', $enable);
if ($res) { if ($res) {
info(t('Test email sent') . EOL); info(L10n::t('Test email sent') . EOL);
} else { } else {
notice(t('There was an error sending the test email') . EOL); notice(L10n::t('There was an error sending the test email') . EOL);
} }
} }
} }

View file

@ -8,6 +8,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function showmore_install() { function showmore_install() {
@ -37,24 +38,24 @@ function showmore_addon_settings(&$a,&$s) {
$chars = '1100'; $chars = '1100';
$s .= '<span id="settings_showmore_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">'; $s .= '<span id="settings_showmore_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">';
$s .= '<h3>' . t('"Show more" Settings').'</h3>'; $s .= '<h3>' . L10n::t('"Show more" Settings').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_showmore_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_showmore_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">';
$s .= '<h3>' . t('"Show more" Settings').'</h3>'; $s .= '<h3>' . L10n::t('"Show more" Settings').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="showmore-wrapper">'; $s .= '<div id="showmore-wrapper">';
$s .= '<label id="showmore-enable-label" for="showmore-enable">'.t('Enable Show More').'</label>'; $s .= '<label id="showmore-enable-label" for="showmore-enable">'.L10n::t('Enable Show More').'</label>';
$s .= '<input id="showmore-enable" type="checkbox" name="showmore-enable" value="1"'.$enable_checked.' />'; $s .= '<input id="showmore-enable" type="checkbox" name="showmore-enable" value="1"'.$enable_checked.' />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="showmore-label" for="showmore-chars">'.t('Cutting posts after how much characters').' </label>'; $s .= '<label id="showmore-label" for="showmore-chars">'.L10n::t('Cutting posts after how much characters').' </label>';
$s .= '<input id="showmore-words" type="text" name="showmore-chars" value="'.$chars.'" />'; $s .= '<input id="showmore-words" type="text" name="showmore-chars" value="'.$chars.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="showmore-submit" name="showmore-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="showmore-submit" name="showmore-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
// $s .= '<div class="showmore-desc">' . t('Use /expression/ to provide regular expressions') . '</div>'; // $s .= '<div class="showmore-desc">' . L10n::t('Use /expression/ to provide regular expressions') . '</div>';
$s .= '</div>'; $s .= '</div>';
return; return;
@ -70,7 +71,7 @@ function showmore_addon_settings_post(&$a,&$b) {
$enable = ((x($_POST,'showmore-enable')) ? intval($_POST['showmore-enable']) : 0); $enable = ((x($_POST,'showmore-enable')) ? intval($_POST['showmore-enable']) : 0);
$disable = 1-$enable; $disable = 1-$enable;
PConfig::set(local_user(),'showmore','disable', $disable); PConfig::set(local_user(),'showmore','disable', $disable);
info( t('Show More Settings saved.') . EOL); info(L10n::t('Show More Settings saved.') . EOL);
} }
} }
@ -124,7 +125,7 @@ function showmore_prepare_body(&$a,&$b) {
if($found) { if($found) {
$rnd = random_string(8); $rnd = random_string(8);
$b['html'] = '<span id="showmore-teaser-'.$rnd.'" class="showmore-teaser" style="display: block;">'.$shortened." ". $b['html'] = '<span id="showmore-teaser-'.$rnd.'" class="showmore-teaser" style="display: block;">'.$shortened." ".
'<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="showmore-wrap fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(t('show more')).'</span></span>'. '<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="showmore-wrap fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.L10n::t('show more').'</span></span>'.
'<div id="showmore-'.$rnd.'" class="showmore-content" style="display: none;">'.$b['html'].'</div>'; '<div id="showmore-'.$rnd.'" class="showmore-content" style="display: none;">'.$b['html'].'</div>';
} }
} }

View file

@ -7,6 +7,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function startpage_install() { function startpage_install() {
@ -51,16 +52,12 @@ function startpage_settings_post($a,$post) {
PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage']))); PConfig::set(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage'])));
} }
/** /**
* *
* Called from the Addon Setting form. * Called from the Addon Setting form.
* Add our own settings info to the page. * Add our own settings info to the page.
* *
*/ */
function startpage_settings(&$a,&$s) { function startpage_settings(&$a,&$s) {
if(! local_user()) if(! local_user())
@ -78,20 +75,20 @@ function startpage_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_startpage_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">'; $s .= '<span id="settings_startpage_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">';
$s .= '<h3>' . t('Startpage') . '</h3>'; $s .= '<h3>' . L10n::t('Startpage') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_startpage_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_startpage_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">';
$s .= '<h3>' . t('Startpage') . '</h3>'; $s .= '<h3>' . L10n::t('Startpage') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="startpage-page-wrapper">'; $s .= '<div id="startpage-page-wrapper">';
$s .= '<label id="startpage-page-label" for="startpage-page">' . t('Home page to load after login - leave blank for profile wall') . '</label>'; $s .= '<label id="startpage-page-label" for="startpage-page">' . L10n::t('Home page to load after login - leave blank for profile wall') . '</label>';
$s .= '<input id="startpage-page" type="text" name="startpage" value="' . $page . '" />'; $s .= '<input id="startpage-page" type="text" name="startpage" value="' . $page . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="startpage-desc">' . t('Examples: &quot;network&quot; or &quot;notifications/system&quot;') . '</div>'; $s .= '<div id="startpage-desc">' . L10n::t('Examples: &quot;network&quot; or &quot;notifications/system&quot;') . '</div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="startpage-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="startpage-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -49,6 +49,7 @@ use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Group; use Friendica\Model\Group;
@ -190,7 +191,7 @@ function statusnet_jot_nets(App $a, &$b)
$statusnet_defpost = PConfig::get(local_user(), 'statusnet', 'post_by_default'); $statusnet_defpost = PConfig::get(local_user(), 'statusnet', 'post_by_default');
$selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> '
. t('Post to GNU Social') . '</div>'; . L10n::t('Post to GNU Social') . '</div>';
} }
} }
@ -238,7 +239,7 @@ function statusnet_settings_post(App $a, $post)
PConfig::set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']); PConfig::set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
//PConfig::set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] ); //PConfig::set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
} else { } else {
notice(t('Please contact your site administrator.<br />The provided API URL is not valid.') . EOL . $asn['apiurl'] . EOL); notice(L10n::t('Please contact your site administrator.<br />The provided API URL is not valid.') . EOL . $asn['apiurl'] . EOL);
} }
} }
} }
@ -267,7 +268,7 @@ function statusnet_settings_post(App $a, $post)
PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase); PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
} else { } else {
// still not the correct API base, let's do noting // still not the correct API base, let's do noting
notice(t('We could not contact the GNU Social API with the Path you entered.') . EOL); notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL);
} }
} }
goaway('settings/connectors'); goaway('settings/connectors');
@ -301,7 +302,7 @@ function statusnet_settings_post(App $a, $post)
if (!intval($_POST['statusnet-mirror'])) if (!intval($_POST['statusnet-mirror']))
PConfig::delete(local_user(), 'statusnet', 'lastid'); PConfig::delete(local_user(), 'statusnet', 'lastid');
info(t('GNU Social settings updated.') . EOL); info(L10n::t('GNU Social settings updated.') . EOL);
} }
} }
} }
@ -342,11 +343,11 @@ function statusnet_settings(App $a, &$s)
$css = (($enabled) ? '' : '-disabled'); $css = (($enabled) ? '' : '-disabled');
$s .= '<span id="settings_statusnet_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">'; $s .= '<span id="settings_statusnet_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">';
$s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . t('GNU Social Import/Export/Mirror') . '</h3>'; $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . L10n::t('GNU Social Import/Export/Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_statusnet_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_statusnet_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">';
$s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . t('GNU Social Import/Export/Mirror') . '</h3>'; $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . L10n::t('GNU Social Import/Export/Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
if ((!$ckey) && (!$csecret)) { if ((!$ckey) && (!$csecret)) {
@ -361,31 +362,31 @@ function statusnet_settings(App $a, &$s)
* ignore this option entirely. * ignore this option entirely.
*/ */
if (!$globalsn == null) { if (!$globalsn == null) {
$s .= '<h4>' . t('Globally Available GNU Social OAuthKeys') . '</h4>'; $s .= '<h4>' . L10n::t('Globally Available GNU Social OAuthKeys') . '</h4>';
$s .= '<p>' . t("There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance \x28see below\x29.") . '</p>'; $s .= '<p>' . L10n::t("There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance \x28see below\x29.") . '</p>';
$s .= '<div id="statusnet-preconf-wrapper">'; $s .= '<div id="statusnet-preconf-wrapper">';
foreach ($globalsn as $asn) { foreach ($globalsn as $asn) {
$s .= '<input type="radio" name="statusnet-preconf-apiurl" value="' . $asn['apiurl'] . '">' . $asn['sitename'] . '<br />'; $s .= '<input type="radio" name="statusnet-preconf-apiurl" value="' . $asn['apiurl'] . '">' . $asn['sitename'] . '<br />';
} }
$s .= '<p></p><div class="clear"></div></div>'; $s .= '<p></p><div class="clear"></div></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
} }
$s .= '<h4>' . t('Provide your own OAuth Credentials') . '</h4>'; $s .= '<h4>' . L10n::t('Provide your own OAuth Credentials') . '</h4>';
$s .= '<p>' . t('No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation.') . '</p>'; $s .= '<p>' . L10n::t('No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation.') . '</p>';
$s .= '<div id="statusnet-consumer-wrapper">'; $s .= '<div id="statusnet-consumer-wrapper">';
$s .= '<label id="statusnet-consumerkey-label" for="statusnet-consumerkey">' . t('OAuth Consumer Key') . '</label>'; $s .= '<label id="statusnet-consumerkey-label" for="statusnet-consumerkey">' . L10n::t('OAuth Consumer Key') . '</label>';
$s .= '<input id="statusnet-consumerkey" type="text" name="statusnet-consumerkey" size="35" /><br />'; $s .= '<input id="statusnet-consumerkey" type="text" name="statusnet-consumerkey" size="35" /><br />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="statusnet-consumersecret-label" for="statusnet-consumersecret">' . t('OAuth Consumer Secret') . '</label>'; $s .= '<label id="statusnet-consumersecret-label" for="statusnet-consumersecret">' . L10n::t('OAuth Consumer Secret') . '</label>';
$s .= '<input id="statusnet-consumersecret" type="text" name="statusnet-consumersecret" size="35" /><br />'; $s .= '<input id="statusnet-consumersecret" type="text" name="statusnet-consumersecret" size="35" /><br />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">' . t("Base API Path \x28remember the trailing /\x29") . '</label>'; $s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">' . L10n::t("Base API Path \x28remember the trailing /\x29") . '</label>';
$s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />'; $s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
//$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.t('GNU Socialapplication name').'</label>'; //$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.L10n::t('GNU Socialapplication name').'</label>';
//$s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />'; //$s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />';
$s .= '<p></p><div class="clear"></div>'; $s .= '<p></p><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '</div>'; $s .= '</div>';
} else { } else {
/* * * /* * *
@ -404,22 +405,22 @@ function statusnet_settings(App $a, &$s)
/* * * /* * *
* make some nice form * make some nice form
*/ */
$s .= '<p>' . t('To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to GNU Social.') . '</p>'; $s .= '<p>' . L10n::t('To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to GNU Social.') . '</p>';
$s .= '<a href="' . $connection->getAuthorizeURL($token, False) . '" target="_statusnet"><img src="addon/statusnet/signinwithstatusnet.png" alt="' . t('Log in with GNU Social') . '"></a>'; $s .= '<a href="' . $connection->getAuthorizeURL($token, False) . '" target="_statusnet"><img src="addon/statusnet/signinwithstatusnet.png" alt="' . L10n::t('Log in with GNU Social') . '"></a>';
$s .= '<div id="statusnet-pin-wrapper">'; $s .= '<div id="statusnet-pin-wrapper">';
$s .= '<label id="statusnet-pin-label" for="statusnet-pin">' . t('Copy the security code from GNU Social here') . '</label>'; $s .= '<label id="statusnet-pin-label" for="statusnet-pin">' . L10n::t('Copy the security code from GNU Social here') . '</label>';
$s .= '<input id="statusnet-pin" type="text" name="statusnet-pin" />'; $s .= '<input id="statusnet-pin" type="text" name="statusnet-pin" />';
$s .= '<input id="statusnet-token" type="hidden" name="statusnet-token" value="' . $token . '" />'; $s .= '<input id="statusnet-token" type="hidden" name="statusnet-token" value="' . $token . '" />';
$s .= '<input id="statusnet-token2" type="hidden" name="statusnet-token2" value="' . $request_token['oauth_token_secret'] . '" />'; $s .= '<input id="statusnet-token2" type="hidden" name="statusnet-token2" value="' . $request_token['oauth_token_secret'] . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
$s .= '<h4>' . t('Cancel Connection Process') . '</h4>'; $s .= '<h4>' . L10n::t('Cancel Connection Process') . '</h4>';
$s .= '<div id="statusnet-cancel-wrapper">'; $s .= '<div id="statusnet-cancel-wrapper">';
$s .= '<p>' . t('Current GNU Social API is') . ': ' . $api . '</p>'; $s .= '<p>' . L10n::t('Current GNU Social API is') . ': ' . $api . '</p>';
$s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">' . t('Cancel GNU Social Connection') . '</label>'; $s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">' . L10n::t('Cancel GNU Social Connection') . '</label>';
$s .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />'; $s .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
} else { } else {
/* * * /* * *
* we have an OAuth key / secret pair for the user * we have an OAuth key / secret pair for the user
@ -427,44 +428,44 @@ function statusnet_settings(App $a, &$s)
*/ */
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$details = $connection->get('account/verify_credentials'); $details = $connection->get('account/verify_credentials');
$s .= '<div id="statusnet-info" ><img id="statusnet-avatar" src="' . $details->profile_image_url . '" /><p id="statusnet-info-block">' . t('Currently connected to: ') . '<a href="' . $details->statusnet_profile_url . '" target="_statusnet">' . $details->screen_name . '</a><br /><em>' . $details->description . '</em></p></div>'; $s .= '<div id="statusnet-info" ><img id="statusnet-avatar" src="' . $details->profile_image_url . '" /><p id="statusnet-info-block">' . L10n::t('Currently connected to: ') . '<a href="' . $details->statusnet_profile_url . '" target="_statusnet">' . $details->screen_name . '</a><br /><em>' . $details->description . '</em></p></div>';
$s .= '<p>' . t('If enabled all your <strong>public</strong> postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') . '</p>'; $s .= '<p>' . L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') . '</p>';
if ($a->user['hidewall']) { if ($a->user['hidewall']) {
$s .= '<p>' . t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>'; $s .= '<p>' . L10n::t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
} }
$s .= '<div id="statusnet-enable-wrapper">'; $s .= '<div id="statusnet-enable-wrapper">';
$s .= '<label id="statusnet-enable-label" for="statusnet-checkbox">' . t('Allow posting to GNU Social') . '</label>'; $s .= '<label id="statusnet-enable-label" for="statusnet-checkbox">' . L10n::t('Allow posting to GNU Social') . '</label>';
$s .= '<input id="statusnet-checkbox" type="checkbox" name="statusnet-enable" value="1" ' . $checked . '/>'; $s .= '<input id="statusnet-checkbox" type="checkbox" name="statusnet-enable" value="1" ' . $checked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="statusnet-default-label" for="statusnet-default">' . t('Send public postings to GNU Social by default') . '</label>'; $s .= '<label id="statusnet-default-label" for="statusnet-default">' . L10n::t('Send public postings to GNU Social by default') . '</label>';
$s .= '<input id="statusnet-default" type="checkbox" name="statusnet-default" value="1" ' . $defchecked . '/>'; $s .= '<input id="statusnet-default" type="checkbox" name="statusnet-default" value="1" ' . $defchecked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<label id="statusnet-mirror-label" for="statusnet-mirror">' . t('Mirror all posts from GNU Social that are no replies or repeated messages') . '</label>'; $s .= '<label id="statusnet-mirror-label" for="statusnet-mirror">' . L10n::t('Mirror all posts from GNU Social that are no replies or repeated messages') . '</label>';
$s .= '<input id="statusnet-mirror" type="checkbox" name="statusnet-mirror" value="1" ' . $mirrorchecked . '/>'; $s .= '<input id="statusnet-mirror" type="checkbox" name="statusnet-mirror" value="1" ' . $mirrorchecked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '</div>'; $s .= '</div>';
$s .= '<label id="statusnet-import-label" for="statusnet-import">' . t('Import the remote timeline') . '</label>'; $s .= '<label id="statusnet-import-label" for="statusnet-import">' . L10n::t('Import the remote timeline') . '</label>';
//$s .= '<input id="statusnet-import" type="checkbox" name="statusnet-import" value="1" '. $importchecked . '/>'; //$s .= '<input id="statusnet-import" type="checkbox" name="statusnet-import" value="1" '. $importchecked . '/>';
$s .= '<select name="statusnet-import" id="statusnet-import" />'; $s .= '<select name="statusnet-import" id="statusnet-import" />';
$s .= '<option value="0" ' . $importselected[0] . '>' . t("Disabled") . '</option>'; $s .= '<option value="0" ' . $importselected[0] . '>' . L10n::t("Disabled") . '</option>';
$s .= '<option value="1" ' . $importselected[1] . '>' . t("Full Timeline") . '</option>'; $s .= '<option value="1" ' . $importselected[1] . '>' . L10n::t("Full Timeline") . '</option>';
$s .= '<option value="2" ' . $importselected[2] . '>' . t("Only Mentions") . '</option>'; $s .= '<option value="2" ' . $importselected[2] . '>' . L10n::t("Only Mentions") . '</option>';
$s .= '</select>'; $s .= '</select>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
/* /*
$s .= '<label id="statusnet-create_user-label" for="statusnet-create_user">'.t('Automatically create contacts').'</label>'; $s .= '<label id="statusnet-create_user-label" for="statusnet-create_user">'.L10n::t('Automatically create contacts').'</label>';
$s .= '<input id="statusnet-create_user" type="checkbox" name="statusnet-create_user" value="1" '. $create_userchecked . '/>'; $s .= '<input id="statusnet-create_user" type="checkbox" name="statusnet-create_user" value="1" '. $create_userchecked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
*/ */
$s .= '<div id="statusnet-disconnect-wrapper">'; $s .= '<div id="statusnet-disconnect-wrapper">';
$s .= '<label id="statusnet-disconnect-label" for="statusnet-disconnect">' . t('Clear OAuth configuration') . '</label>'; $s .= '<label id="statusnet-disconnect-label" for="statusnet-disconnect">' . L10n::t('Clear OAuth configuration') . '</label>';
$s .= '<input id="statusnet-disconnect" type="checkbox" name="statusnet-disconnect" value="1" />'; $s .= '<input id="statusnet-disconnect" type="checkbox" name="statusnet-disconnect" value="1" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
} }
} }
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -747,7 +748,7 @@ function statusnet_addon_admin(App $a, &$o)
foreach ($sites as $id => $s) { foreach ($sites as $id => $s) {
$sitesform[] = [ $sitesform[] = [
'sitename' => ["sitename[$id]", "Site name", $s['sitename'], ""], 'sitename' => ["sitename[$id]", "Site name", $s['sitename'], ""],
'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29")], 'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], L10n::t("Base API Path \x28remember the trailing /\x29")],
'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""], 'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""],
'key' => ["key[$id]", "Key", $s['consumerkey'], ""], 'key' => ["key[$id]", "Key", $s['consumerkey'], ""],
//'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""), //'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
@ -758,16 +759,16 @@ function statusnet_addon_admin(App $a, &$o)
/* empty form to add new site */ /* empty form to add new site */
$id++; $id++;
$sitesform[] = [ $sitesform[] = [
'sitename' => ["sitename[$id]", t("Site name"), "", ""], 'sitename' => ["sitename[$id]", L10n::t("Site name"), "", ""],
'apiurl' => ["apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29")], 'apiurl' => ["apiurl[$id]", "Api url", "", L10n::t("Base API Path \x28remember the trailing /\x29")],
'secret' => ["secret[$id]", t("Consumer Secret"), "", ""], 'secret' => ["secret[$id]", L10n::t("Consumer Secret"), "", ""],
'key' => ["key[$id]", t("Consumer Key"), "", ""], 'key' => ["key[$id]", L10n::t("Consumer Key"), "", ""],
//'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""), //'applicationname' => Array("applicationname[$id]", L10n::t("Application name"), "", ""),
]; ];
$t = get_markup_template("admin.tpl", "addon/statusnet/"); $t = get_markup_template("admin.tpl", "addon/statusnet/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$sites' => $sitesform, '$sites' => $sitesform,
]); ]);
} }

View file

@ -9,6 +9,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function superblock_install() { function superblock_install() {
@ -52,18 +53,18 @@ function superblock_addon_settings(&$a,&$s) {
} }
$s .= '<span id="settings_superblock_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">'; $s .= '<span id="settings_superblock_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
$s .= '<h3>' . t('"Superblock"') . '</h3>'; $s .= '<h3>' . L10n::t('"Superblock"') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_superblock_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_superblock_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
$s .= '<h3>' . t('"Superblock"') . '</h3>'; $s .= '<h3>' . L10n::t('"Superblock"') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="superblock-wrapper">'; $s .= '<div id="superblock-wrapper">';
$s .= '<label id="superblock-label" for="superblock-words">' . t('Comma separated profile URLS to block') . ' </label>'; $s .= '<label id="superblock-label" for="superblock-words">' . L10n::t('Comma separated profile URLS to block') . ' </label>';
$s .= '<textarea id="superblock-words" type="text" name="superblock-words" >' . htmlspecialchars($words) . '</textarea>'; $s .= '<textarea id="superblock-words" type="text" name="superblock-words" >' . htmlspecialchars($words) . '</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="superblock-submit" name="superblock-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="superblock-submit" name="superblock-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
return; return;
} }
@ -75,7 +76,7 @@ function superblock_addon_settings_post(&$a,&$b) {
if($_POST['superblock-submit']) { if($_POST['superblock-submit']) {
PConfig::set(local_user(),'system','blocked',trim($_POST['superblock-words'])); PConfig::set(local_user(),'system','blocked',trim($_POST['superblock-words']));
info( t('SUPERBLOCK Settings saved.') . EOL); info(L10n::t('SUPERBLOCK Settings saved.') . EOL);
} }
} }
@ -147,7 +148,7 @@ function superblock_item_photo_menu(&$a,&$b) {
} }
} }
$b['menu'][ t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;'; $b['menu'][L10n::t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;';
} }
function superblock_module() {} function superblock_module() {}
@ -167,6 +168,6 @@ function superblock_init(&$a) {
} }
PConfig::set(local_user(),'system','blocked',$words); PConfig::set(local_user(),'system','blocked',$words);
info( t('superblock settings updated') . EOL ); info(L10n::t('superblock settings updated') . EOL );
killme(); killme();
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: testdrive * Name: testdrive
* Description: Sample Friendica addon for creating a test drive Friendica site with automatic account expiration. * Description: Sample Friendica addon for creating a test drive Friendica site with automatic account expiration.
@ -8,9 +7,9 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Model\User; use Friendica\Model\User;
function testdrive_install() { function testdrive_install() {
Addon::registerHook('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account'); Addon::registerHook('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account');
@ -65,7 +64,7 @@ function testdrive_cron($a,$b) {
'language' => $rr['language'], 'language' => $rr['language'],
'to_name' => $rr['username'], 'to_name' => $rr['username'],
'to_email' => $rr['email'], 'to_email' => $rr['email'],
'source_name' => t('Administrator'), 'source_name' => L10n::t('Administrator'),
'source_link' => $a->get_baseurl(), 'source_link' => $a->get_baseurl(),
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg', 'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
]); ]);
@ -90,8 +89,8 @@ function testdrive_enotify(&$a, &$b) {
if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') { && x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') {
$b['itemlink'] = $a->get_baseurl(); $b['itemlink'] = $a->get_baseurl();
$b['epreamble'] = $b['preamble'] = sprintf( t('Your account on %s will expire in a few days.'), Config::get('system','sitename')); $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
$b['subject'] = t('Your Friendica test account is about to expire.'); $b['subject'] = L10n::t('Your Friendica test account is about to expire.');
$b['body'] = sprintf( t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com."), $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server()); $b['body'] = L10n::t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com.", $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server());
} }
} }

View file

@ -6,6 +6,7 @@
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike> * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function tictac_install() { function tictac_install() {
Addon::registerHook('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu'); Addon::registerHook('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu');
@ -17,7 +18,7 @@ function tictac_uninstall() {
} }
function tictac_app_menu($a,&$b) { function tictac_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="tictac">' . t('Three Dimensional Tic-Tac-Toe') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="tictac">' . L10n::t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
} }
@ -50,17 +51,17 @@ function tictac_content(&$a) {
$dimen = 3; $dimen = 3;
} }
$o .= '<h3>' . t('3D Tic-Tac-Toe') . '</h3><br />'; $o .= '<h3>' . L10n::t('3D Tic-Tac-Toe') . '</h3><br />';
$t = new tictac($dimen,$handicap,$mefirst,$yours,$mine); $t = new tictac($dimen,$handicap,$mefirst,$yours,$mine);
$o .= $t->play(); $o .= $t->play();
$o .= '<a href="tictac">' . t('New game') . '</a><br />'; $o .= '<a href="tictac">' . L10n::t('New game') . '</a><br />';
$o .= '<a href="tictac/1">' . t('New game with handicap') . '</a><br />'; $o .= '<a href="tictac/1">' . L10n::t('New game with handicap') . '</a><br />';
$o .= '<p>' . t('Three dimensional tic-tac-toe is just like the traditional game except that it is played on multiple levels simultaneously. '); $o .= '<p>' . L10n::t('Three dimensional tic-tac-toe is just like the traditional game except that it is played on multiple levels simultaneously. ');
$o .= t('In this case there are three levels. You win by getting three in a row on any level, as well as up, down, and diagonally across the different levels.'); $o .= L10n::t('In this case there are three levels. You win by getting three in a row on any level, as well as up, down, and diagonally across the different levels.');
$o .= '</p><p>'; $o .= '</p><p>';
$o .= t('The handicap game disables the center position on the middle level because the player claiming this square often has an unfair advantage.'); $o .= L10n::t('The handicap game disables the center position on the middle level because the player claiming this square often has an unfair advantage.');
$o .= '</p>'; $o .= '</p>';
return $o; return $o;
@ -179,24 +180,24 @@ class tictac {
if($this->first_move) { if($this->first_move) {
if(rand(0,1) == 1) { if(rand(0,1) == 1) {
$o .= '<div class="error-message">' . t('You go first...') . '</div><br />'; $o .= '<div class="error-message">' . L10n::t('You go first...') . '</div><br />';
$this->mefirst = 0; $this->mefirst = 0;
$o .= $this->draw_board(); $o .= $this->draw_board();
return $o; return $o;
} }
$o .= '<div class="error-message">' . t('I\'m going first this time...') . ' </div><br />'; $o .= '<div class="error-message">' . L10n::t('I\'m going first this time...') . ' </div><br />';
$this->mefirst = 1; $this->mefirst = 1;
} }
if($this->check_youwin()) { if($this->check_youwin()) {
$o .= '<div class="error-message">' . t('You won!') . '</div><br />'; $o .= '<div class="error-message">' . L10n::t('You won!') . '</div><br />';
$o .= $this->draw_board(); $o .= $this->draw_board();
return $o; return $o;
} }
if($this->fullboard()) if($this->fullboard())
$o .= '<div class="error-message">' . t('"Cat" game!') . '</div><br />'; $o .= '<div class="error-message">' . L10n::t('"Cat" game!') . '</div><br />';
$move = $this->winning_move(); $move = $this->winning_move();
if(strlen($move)) { if(strlen($move)) {
@ -219,9 +220,9 @@ class tictac {
} }
if($this->check_iwon()) if($this->check_iwon())
$o .= '<div class="error-message">' . t('I won!') . '</div><br />'; $o .= '<div class="error-message">' . L10n::t('I won!') . '</div><br />';
if($this->fullboard()) if($this->fullboard())
$o .= '<div class="error-message">' . t('"Cat" game!') . '</div><br />'; $o .= '<div class="error-message">' . L10n::t('"Cat" game!') . '</div><br />';
$o .= $this->draw_board(); $o .= $this->draw_board();
return $o; return $o;
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: Tumblr Post Connector * Name: Tumblr Post Connector
* Description: Post to Tumblr * Description: Post to Tumblr
@ -8,11 +7,12 @@
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/ */
require_once('library/OAuth1.php'); require_once 'library/OAuth1.php';
require_once('addon/tumblr/tumblroauth/tumblroauth.php'); require_once 'addon/tumblr/tumblroauth/tumblroauth.php';
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function tumblr_install() { function tumblr_install() {
@ -36,7 +36,7 @@ function tumblr_module() {}
function tumblr_content(&$a) { function tumblr_content(&$a) {
if(! local_user()) { if(! local_user()) {
notice( t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
return ''; return '';
} }
@ -62,10 +62,10 @@ function tumblr_addon_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/tumblr/" ); $t = get_markup_template( "admin.tpl", "addon/tumblr/" );
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$consumer_key' => ['consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''], '$consumer_key' => ['consumer_key', L10n::t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''],
'$consumer_secret' => ['consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''], '$consumer_secret' => ['consumer_secret', L10n::t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''],
]); ]);
} }
@ -74,7 +74,7 @@ function tumblr_addon_admin_post(&$a){
$consumer_secret = ((x($_POST,'consumer_secret')) ? notags(trim($_POST['consumer_secret'])): ''); $consumer_secret = ((x($_POST,'consumer_secret')) ? notags(trim($_POST['consumer_secret'])): '');
Config::set('tumblr','consumer_key',$consumer_key); Config::set('tumblr','consumer_key',$consumer_key);
Config::set('tumblr','consumer_secret',$consumer_secret); Config::set('tumblr','consumer_secret',$consumer_secret);
info( t('Settings updated.'). EOL ); info(L10n::t('Settings updated.'). EOL);
} }
function tumblr_connect($a) { function tumblr_connect($a) {
@ -165,8 +165,8 @@ function tumblr_callback($a) {
PConfig::set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']); PConfig::set(local_user(), "tumblr", "oauth_token", $access_token['oauth_token']);
PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']); PConfig::set(local_user(), "tumblr", "oauth_token_secret", $access_token['oauth_token_secret']);
$o = t("You are now authenticated to tumblr."); $o = L10n::t("You are now authenticated to tumblr.");
$o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.t("return to the connector page").'</a>'; $o .= '<br /><a href="'.$a->get_baseurl().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
return($o); return($o);
} }
@ -179,7 +179,7 @@ function tumblr_jot_nets(&$a,&$b) {
$tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default'); $tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default');
$selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> '
. t('Post to Tumblr') . '</div>'; . L10n::t('Post to Tumblr') . '</div>';
} }
} }
@ -206,24 +206,24 @@ function tumblr_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_tumblr_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_tumblr_expanded\'); openClose(\'settings_tumblr_inflated\');">'; $s .= '<span id="settings_tumblr_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_tumblr_expanded\'); openClose(\'settings_tumblr_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/tumblr.png" /><h3 class="connector">'. t('Tumblr Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/tumblr.png" /><h3 class="connector">'. L10n::t('Tumblr Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_tumblr_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_tumblr_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_tumblr_expanded\'); openClose(\'settings_tumblr_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_tumblr_expanded\'); openClose(\'settings_tumblr_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/tumblr.png" /><h3 class="connector">'. t('Tumblr Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/tumblr.png" /><h3 class="connector">'. L10n::t('Tumblr Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="tumblr-username-wrapper">'; $s .= '<div id="tumblr-username-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/tumblr/connect">'.t("(Re-)Authenticate your tumblr page").'</a>'; $s .= '<a href="'.$a->get_baseurl().'/tumblr/connect">'.L10n::t("(Re-)Authenticate your tumblr page").'</a>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="tumblr-enable-wrapper">'; $s .= '<div id="tumblr-enable-wrapper">';
$s .= '<label id="tumblr-enable-label" for="tumblr-checkbox">' . t('Enable Tumblr Post Addon') . '</label>'; $s .= '<label id="tumblr-enable-label" for="tumblr-checkbox">' . L10n::t('Enable Tumblr Post Addon') . '</label>';
$s .= '<input id="tumblr-checkbox" type="checkbox" name="tumblr" value="1" ' . $checked . '/>'; $s .= '<input id="tumblr-checkbox" type="checkbox" name="tumblr" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="tumblr-bydefault-wrapper">'; $s .= '<div id="tumblr-bydefault-wrapper">';
$s .= '<label id="tumblr-bydefault-label" for="tumblr-bydefault">' . t('Post to Tumblr by default') . '</label>'; $s .= '<label id="tumblr-bydefault-label" for="tumblr-bydefault">' . L10n::t('Post to Tumblr by default') . '</label>';
$s .= '<input id="tumblr-bydefault" type="checkbox" name="tumblr_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="tumblr-bydefault" type="checkbox" name="tumblr_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -243,7 +243,7 @@ function tumblr_settings(&$a,&$s) {
$blogs = []; $blogs = [];
$s .= '<label id="tumblr-page-label" for="tumblr-page">' . t('Post to page:') . '</label>'; $s .= '<label id="tumblr-page-label" for="tumblr-page">' . L10n::t('Post to page:') . '</label>';
$s .= '<select name="tumblr_page" id="tumblr-page">'; $s .= '<select name="tumblr_page" id="tumblr-page">';
foreach($userinfo->response->user->blogs as $blog) { foreach($userinfo->response->user->blogs as $blog) {
$blogurl = substr(str_replace(["http://", "https://"], ["", ""], $blog->url), 0, -1); $blogurl = substr(str_replace(["http://", "https://"], ["", ""], $blog->url), 0, -1);
@ -255,12 +255,12 @@ function tumblr_settings(&$a,&$s) {
$s .= "</select>"; $s .= "</select>";
} else } else
$s .= t("You are not authenticated to tumblr"); $s .= L10n::t("You are not authenticated to tumblr");
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="tumblr-submit" name="tumblr-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="tumblr-submit" name="tumblr-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: Twitter Connector * Name: Twitter Connector
* Description: Bidirectional (posting, relaying and reading) connector for Twitter. * Description: Bidirectional (posting, relaying and reading) connector for Twitter.
@ -64,6 +63,7 @@ use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -180,7 +180,7 @@ function twitter_jot_nets(App $a, &$b)
$tw_defpost = PConfig::get(local_user(), 'twitter', 'post_by_default'); $tw_defpost = PConfig::get(local_user(), 'twitter', 'post_by_default');
$selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> '
. t('Post to Twitter') . '</div>'; . L10n::t('Post to Twitter') . '</div>';
} }
} }
@ -241,7 +241,7 @@ function twitter_settings_post(App $a, $post)
PConfig::delete(local_user(), 'twitter', 'lastid'); PConfig::delete(local_user(), 'twitter', 'lastid');
} }
info(t('Twitter settings updated.') . EOL); info(L10n::t('Twitter settings updated.') . EOL);
} }
} }
} }
@ -271,11 +271,11 @@ function twitter_settings(App $a, &$s)
$css = (($enabled) ? '' : '-disabled'); $css = (($enabled) ? '' : '-disabled');
$s .= '<span id="settings_twitter_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_twitter_expanded\'); openClose(\'settings_twitter_inflated\');">'; $s .= '<span id="settings_twitter_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_twitter_expanded\'); openClose(\'settings_twitter_inflated\');">';
$s .= '<img class="connector' . $css . '" src="images/twitter.png" /><h3 class="connector">' . t('Twitter Import/Export/Mirror') . '</h3>'; $s .= '<img class="connector' . $css . '" src="images/twitter.png" /><h3 class="connector">' . L10n::t('Twitter Import/Export/Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_twitter_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_twitter_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_twitter_expanded\'); openClose(\'settings_twitter_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_twitter_expanded\'); openClose(\'settings_twitter_inflated\');">';
$s .= '<img class="connector' . $css . '" src="images/twitter.png" /><h3 class="connector">' . t('Twitter Import/Export/Mirror') . '</h3>'; $s .= '<img class="connector' . $css . '" src="images/twitter.png" /><h3 class="connector">' . L10n::t('Twitter Import/Export/Mirror') . '</h3>';
$s .= '</span>'; $s .= '</span>';
if ((!$ckey) && (!$csecret)) { if ((!$ckey) && (!$csecret)) {
@ -283,7 +283,7 @@ function twitter_settings(App $a, &$s)
* no global consumer keys * no global consumer keys
* display warning and skip personal config * display warning and skip personal config
*/ */
$s .= '<p>' . t('No consumer key pair for Twitter found. Please contact your site administrator.') . '</p>'; $s .= '<p>' . L10n::t('No consumer key pair for Twitter found. Please contact your site administrator.') . '</p>';
} else { } else {
/* * * /* * *
* ok we have a consumer key pair now look into the OAuth stuff * ok we have a consumer key pair now look into the OAuth stuff
@ -302,15 +302,15 @@ function twitter_settings(App $a, &$s)
/* * * /* * *
* make some nice form * make some nice form
*/ */
$s .= '<p>' . t('At this Friendica instance the Twitter addon was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to Twitter.') . '</p>'; $s .= '<p>' . L10n::t('At this Friendica instance the Twitter addon was enabled but you have not yet connected your account to your Twitter account. To do so click the button below to get a PIN from Twitter which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to Twitter.') . '</p>';
$s .= '<a href="' . $connection->getAuthorizeURL($token) . '" target="_twitter"><img src="addon/twitter/lighter.png" alt="' . t('Log in with Twitter') . '"></a>'; $s .= '<a href="' . $connection->getAuthorizeURL($token) . '" target="_twitter"><img src="addon/twitter/lighter.png" alt="' . L10n::t('Log in with Twitter') . '"></a>';
$s .= '<div id="twitter-pin-wrapper">'; $s .= '<div id="twitter-pin-wrapper">';
$s .= '<label id="twitter-pin-label" for="twitter-pin">' . t('Copy the PIN from Twitter here') . '</label>'; $s .= '<label id="twitter-pin-label" for="twitter-pin">' . L10n::t('Copy the PIN from Twitter here') . '</label>';
$s .= '<input id="twitter-pin" type="text" name="twitter-pin" />'; $s .= '<input id="twitter-pin" type="text" name="twitter-pin" />';
$s .= '<input id="twitter-token" type="hidden" name="twitter-token" value="' . $token . '" />'; $s .= '<input id="twitter-token" type="hidden" name="twitter-token" value="' . $token . '" />';
$s .= '<input id="twitter-token2" type="hidden" name="twitter-token2" value="' . $request_token['oauth_token_secret'] . '" />'; $s .= '<input id="twitter-token2" type="hidden" name="twitter-token2" value="' . $request_token['oauth_token_secret'] . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
} else { } else {
/* * * /* * *
* we have an OAuth key / secret pair for the user * we have an OAuth key / secret pair for the user
@ -323,8 +323,8 @@ function twitter_settings(App $a, &$s)
$field_checkbox = get_markup_template('field_checkbox.tpl'); $field_checkbox = get_markup_template('field_checkbox.tpl');
$s .= '<div id="twitter-info" > $s .= '<div id="twitter-info" >
<p>' . t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a> <p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a>
<button type="submit" name="twitter-disconnect" value="1">' . t('Disconnect') . '</button> <button type="submit" name="twitter-disconnect" value="1">' . L10n::t('Disconnect') . '</button>
</p> </p>
<p id="twitter-info-block"> <p id="twitter-info-block">
<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter"><img id="twitter-avatar" src="' . $details->profile_image_url . '" /></a> <a href="https://twitter.com/' . $details->screen_name . '" target="_twitter"><img id="twitter-avatar" src="' . $details->profile_image_url . '" /></a>
@ -334,26 +334,26 @@ function twitter_settings(App $a, &$s)
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= replace_macros($field_checkbox, [ $s .= replace_macros($field_checkbox, [
'$field' => ['twitter-enable', t('Allow posting to Twitter'), $enabled, t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')] '$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
]); ]);
if ($a->user['hidewall']) { if ($a->user['hidewall']) {
$s .= '<p>' . t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>'; $s .= '<p>' . L10n::t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
} }
$s .= replace_macros($field_checkbox, [ $s .= replace_macros($field_checkbox, [
'$field' => ['twitter-default', t('Send public postings to Twitter by default'), $defenabled, ''] '$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, '']
]); ]);
$s .= replace_macros($field_checkbox, [ $s .= replace_macros($field_checkbox, [
'$field' => ['twitter-mirror', t('Mirror all posts from twitter that are no replies'), $mirrorenabled, ''] '$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '']
]); ]);
$s .= replace_macros($field_checkbox, [ $s .= replace_macros($field_checkbox, [
'$field' => ['twitter-import', t('Import the remote timeline'), $importenabled, ''] '$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, '']
]); ]);
$s .= replace_macros($field_checkbox, [ $s .= replace_macros($field_checkbox, [
'$field' => ['twitter-create_user', t('Automatically create contacts'), $create_userenabled, ''] '$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, '']
]); ]);
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="twitter-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
} }
} }
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -630,8 +630,7 @@ function twitter_post_hook(App $a, &$b)
$s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]); $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
Queue::add($a->contact, NETWORK_TWITTER, $s); Queue::add($a->contact, NETWORK_TWITTER, $s);
notice(L10n::t('Twitter post failed. Queued for retry.') . EOL);
notice(t('Twitter post failed. Queued for retry.') . EOL);
} elseif ($iscomment) { } elseif ($iscomment) {
logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']); logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
@ -649,7 +648,7 @@ function twitter_addon_admin_post(App $a)
$consumersecret = x($_POST, 'consumersecret') ? notags(trim($_POST['consumersecret'])) : ''; $consumersecret = x($_POST, 'consumersecret') ? notags(trim($_POST['consumersecret'])) : '';
Config::set('twitter', 'consumerkey', $consumerkey); Config::set('twitter', 'consumerkey', $consumerkey);
Config::set('twitter', 'consumersecret', $consumersecret); Config::set('twitter', 'consumersecret', $consumersecret);
info(t('Settings updated.') . EOL); info(L10n::t('Settings updated.') . EOL);
} }
function twitter_addon_admin(App $a, &$o) function twitter_addon_admin(App $a, &$o)
@ -657,10 +656,10 @@ function twitter_addon_admin(App $a, &$o)
$t = get_markup_template("admin.tpl", "addon/twitter/"); $t = get_markup_template("admin.tpl", "addon/twitter/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$consumerkey' => ['consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey'), ''], '$consumerkey' => ['consumerkey', L10n::t('Consumer key'), Config::get('twitter', 'consumerkey'), ''],
'$consumersecret' => ['consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''], '$consumersecret' => ['consumersecret', L10n::t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''],
]); ]);
} }

View file

@ -7,6 +7,7 @@
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
function viewsrc_install() { function viewsrc_install() {
Addon::registerHook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); Addon::registerHook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
@ -32,27 +33,29 @@ function viewsrc_page_end(&$a, &$o){
EOS; EOS;
} }
function viewsrc_item_photo_menu(&$a,&$b) { function viewsrc_item_photo_menu(&$a, &$b)
if(!local_user()) {
if (!local_user()) {
return; return;
}
if (local_user() != $b['item']['uid']) { if (local_user() != $b['item']['uid']) {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `guid` = '%s'", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `guid` = '%s'",
intval(local_user()), dbesc($b['item']['guid'])); intval(local_user()), dbesc($b['item']['guid']));
if (!$r) if (!$r) {
return; return;
}
$item_id = $r[0]['id']; $item_id = $r[0]['id'];
} else {
} else
$item_id = $b['item']['id']; $item_id = $b['item']['id'];
}
$b['menu'] = array_merge( [ t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id], $b['menu']); $b['menu'] = array_merge([L10n::t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id], $b['menu']);
//if((! local_user()) || (local_user() != $b['item']['uid'])) //if((! local_user()) || (local_user() != $b['item']['uid']))
// return; // return;
//$b['menu'] = array_merge( array( t('View Source') => $a->get_baseurl() . '/viewsrc/'. $b['item']['id']), $b['menu']); //$b['menu'] = array_merge(array(L10n::t('View Source') => $a->get_baseurl() . '/viewsrc/'. $b['item']['id']), $b['menu']);
} }

View file

@ -8,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function webrtc_install() { function webrtc_install() {
Addon::registerHook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu'); Addon::registerHook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
@ -19,20 +20,20 @@ function webrtc_uninstall() {
} }
function webrtc_app_menu($a,&$b) { function webrtc_app_menu($a,&$b) {
$b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . t('WebRTC Videochat') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . L10n::t('WebRTC Videochat') . '</a></div>';
} }
function webrtc_addon_admin (&$a, &$o) { function webrtc_addon_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/webrtc/" ); $t = get_markup_template( "admin.tpl", "addon/webrtc/" );
$o = replace_macros( $t, [ $o = replace_macros( $t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$webrtcurl' => ['webrtcurl', t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')], '$webrtcurl' => ['webrtcurl', L10n::t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), L10n::t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
]); ]);
} }
function webrtc_addon_admin_post (&$a) { function webrtc_addon_admin_post (&$a) {
$url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : ''); $url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : '');
Config::set('webrtc', 'webrtcurl', $url); Config::set('webrtc', 'webrtcurl', $url);
info( t('Settings updated.'). EOL); info(L10n::t('Settings updated.'). EOL);
} }
function webrtc_module() { function webrtc_module() {
@ -46,10 +47,10 @@ function webrtc_content(&$a) {
$webrtcurl = Config::get('webrtc','webrtcurl'); $webrtcurl = Config::get('webrtc','webrtcurl');
/* embedd the landing page in an iframe */ /* embedd the landing page in an iframe */
$o .= '<h2>'.t('Video Chat').'</h2>'; $o .= '<h2>'.L10n::t('Video Chat').'</h2>';
$o .= '<p>'.t('WebRTC is a video and audio conferencing tool that works with Firefox (version 21 and above) and Chrome/Chromium (version 25 and above). Just create a new chat room and send the link to someone you want to chat with.').'</p>'; $o .= '<p>'.L10n::t('WebRTC is a video and audio conferencing tool that works with Firefox (version 21 and above) and Chrome/Chromium (version 25 and above). Just create a new chat room and send the link to someone you want to chat with.').'</p>';
if ($webrtcurl == '') { if ($webrtcurl == '') {
$o .= '<p>'.t('Please contact your friendica admin and send a reminder to configure the WebRTC addon.').'</p>'; $o .= '<p>'.L10n::t('Please contact your friendica admin and send a reminder to configure the WebRTC addon.').'</p>';
} else { } else {
$o .= '<iframe src="'.$webrtcurl.'" width="600px" height="600px"></iframe>'; $o .= '<iframe src="'.$webrtcurl.'" width="600px" height="600px"></iframe>';
} }

View file

@ -1,29 +1,38 @@
<?php <?php
function friendheader_widget_name() { use Friendica\Core\L10n;
function friendheader_widget_name()
{
return "Shows friends as a bar"; return "Shows friends as a bar";
} }
function friendheader_widget_help() { function friendheader_widget_help()
{
return ""; return "";
} }
function friendheader_widget_args(){ function friendheader_widget_args()
{
return []; return [];
} }
function friendheader_widget_size(){ function friendheader_widget_size()
{
return ['780px','140px']; return ['780px','140px'];
} }
function friendheader_widget_content(&$a, $conf){ function friendheader_widget_content(&$a, $conf)
{
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1", WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1",
intval($conf['uid']) intval($conf['uid'])
); );
if(!count($r)) return; if (!count($r)) {
return;
}
$a->profile = $r[0]; $a->profile = $r[0];
$o = ""; $o = "";
@ -37,7 +46,7 @@ function friendheader_widget_content(&$a, $conf){
</style>"; </style>";
$o .= _abs_url(contact_block()); $o .= _abs_url(contact_block());
$o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."' target=new>". t('Get added to this list!') ."</a>"; $o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."' target=new>". L10n::t('Get added to this list!') ."</a>";
return $o; return $o;
} }

View file

@ -1,29 +1,40 @@
<?php <?php
function friends_widget_name() { use Friendica\Core\L10n;
function friends_widget_name()
{
return "Shows profile contacts"; return "Shows profile contacts";
} }
function friends_widget_help() {
function friends_widget_help()
{
return ""; return "";
} }
function friends_widget_args(){ function friends_widget_args()
{
return []; return [];
} }
function friends_widget_size(){ function friends_widget_size()
return ['100%','200px']; {
return ['100%', '200px'];
} }
function friends_widget_content(&$a, $conf){ function friends_widget_content(&$a, $conf)
{
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile` $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid` LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1", WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1",
intval($conf['uid']) intval($conf['uid'])
); );
if(!count($r)) return;
if (!count($r)) {
return;
}
$a->profile = $r[0]; $a->profile = $r[0];
$o = ""; $o = "";
@ -37,6 +48,6 @@ function friends_widget_content(&$a, $conf){
</style>"; </style>";
$o .= _abs_url(contact_block()); $o .= _abs_url(contact_block());
$o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."'>". t('Connect on Friendica!') ."</a>"; $o .= "<a href='".$a->get_baseurl().'/profile/'.$a->profile['nickname']."'>". L10n::t('Connect on Friendica!') ."</a>";
return $o; return $o;
} }

View file

@ -1,5 +1,7 @@
<?php <?php
use Friendica\Core\L10n;
function like_widget_name() { function like_widget_name() {
return "Shows likes"; return "Shows likes";
} }
@ -56,10 +58,10 @@ function like_widget_content(&$a, $conf){
$t = get_markup_template("widget_like.tpl", "addon/widgets/"); $t = get_markup_template("widget_like.tpl", "addon/widgets/");
$o .= replace_macros($t, [ $o .= replace_macros($t, [
'$like' => $likes, '$like' => $likes,
'$strlike' => sprintf( tt("%d person likes this", "%d people like this", $likes), $likes), '$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes),
'$dislike' => $dislikes, '$dislike' => $dislikes,
'$strdislike'=> sprintf( tt("%d person doesn't like this", "%d people don't like this", $dislikes), $dislikes), '$strdislike'=> L10n::tt("%d person doesn't like this", "%d people don't like this", $dislikes),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
]); ]);

View file

@ -6,6 +6,7 @@
* Author: Fabio Comuni <http://kirgroup.com/profile/fabrix/> * Author: Fabio Comuni <http://kirgroup.com/profile/fabrix/>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function widgets_install() { function widgets_install() {
@ -55,12 +56,12 @@ function widgets_settings(&$a,&$o) {
# $t = file_get_contents( dirname(__file__). "/settings.tpl" ); # $t = file_get_contents( dirname(__file__). "/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/widgets/"); $t = get_markup_template("settings.tpl", "addon/widgets/");
$o .= replace_macros($t, [ $o .= replace_macros($t, [
'$submit' => t('Generate new key'), '$submit' => L10n::t('Generate new key'),
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$title' => "Widgets", '$title' => "Widgets",
'$label' => t('Widgets key'), '$label' => L10n::t('Widgets key'),
'$key' => $key, '$key' => $key,
'$widgets_h' => t('Widgets available'), '$widgets_h' => L10n::t('Widgets available'),
'$widgets' => $widgets, '$widgets' => $widgets,
]); ]);
@ -122,7 +123,7 @@ function widgets_content(&$a) {
if (isset($_GET['p']) && local_user()==$conf['uid'] ) { if (isset($_GET['p']) && local_user()==$conf['uid'] ) {
$o .= "<style>.f9k_widget { float: left;border:1px solid black; }</style>"; $o .= "<style>.f9k_widget { float: left;border:1px solid black; }</style>";
$o .= "<h1>Preview Widget</h1>"; $o .= "<h1>Preview Widget</h1>";
$o .= '<a href="'.$a->get_baseurl().'/settings/addon">'. t("Addon Settings") .'</a>'; $o .= '<a href="'.$a->get_baseurl().'/settings/addon">'. L10n::t("Addon Settings") .'</a>';
$o .= "<h4>".call_user_func($a->argv[1].'_widget_name')."</h4>"; $o .= "<h4>".call_user_func($a->argv[1].'_widget_name')."</h4>";
$o .= call_user_func($a->argv[1].'_widget_help'); $o .= call_user_func($a->argv[1].'_widget_help');
@ -167,14 +168,8 @@ function widgets_content(&$a) {
return $o; return $o;
} }
} }
echo $o; echo $o;
killme(); killme();
} }
?>

View file

@ -27,6 +27,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Model\User; use Friendica\Model\User;
@ -86,7 +87,7 @@ function windowsphonepush_settings_post($a, $post)
PConfig::set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext'])); PConfig::set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
info(t('WindowsPhonePush settings updated.') . EOL); info(L10n::t('WindowsPhonePush settings updated.') . EOL);
} }
/* Called from the Addon Setting form. /* Called from the Addon Setting form.
@ -112,20 +113,20 @@ function windowsphonepush_settings(&$a, &$s)
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('WindowsPhonePush Settings') . '</h3>'; $s .= '<h3>' . L10n::t('WindowsPhonePush Settings') . '</h3>';
$s .= '<div id="windowsphonepush-enable-wrapper">'; $s .= '<div id="windowsphonepush-enable-wrapper">';
$s .= '<label id="windowsphonepush-enable-label" for="windowsphonepush-enable-chk">' . t('Enable WindowsPhonePush Addon') . '</label>'; $s .= '<label id="windowsphonepush-enable-label" for="windowsphonepush-enable-chk">' . L10n::t('Enable WindowsPhonePush Addon') . '</label>';
$s .= '<input id="windowsphonepush-enable-chk" type="checkbox" name="windowsphonepush" value="1" ' . $checked_enabled . '/>'; $s .= '<input id="windowsphonepush-enable-chk" type="checkbox" name="windowsphonepush" value="1" ' . $checked_enabled . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="windowsphonepush-senditemtext-wrapper">'; $s .= '<div id="windowsphonepush-senditemtext-wrapper">';
$s .= '<label id="windowsphonepush-senditemtext-label" for="windowsphonepush-senditemtext-chk">' . t('Push text of new item') . '</label>'; $s .= '<label id="windowsphonepush-senditemtext-label" for="windowsphonepush-senditemtext-chk">' . L10n::t('Push text of new item') . '</label>';
$s .= '<input id="windowsphonepush-senditemtext-chk" type="checkbox" name="windowsphonepush-senditemtext" value="1" ' . $checked_senditemtext . '/>'; $s .= '<input id="windowsphonepush-senditemtext-chk" type="checkbox" name="windowsphonepush-senditemtext" value="1" ' . $checked_senditemtext . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button - enable und senditemtext can be changed by the user */ /* provide a submit button - enable und senditemtext can be changed by the user */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="windowsphonepush-submit" name="windowsphonepush-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div><div class="clear"></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="windowsphonepush-submit" name="windowsphonepush-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div><div class="clear"></div>';
/* provide further read-only information concerning the addon (useful for */ /* provide further read-only information concerning the addon (useful for */
$s .= '<div id="windowsphonepush-device_url-wrapper">'; $s .= '<div id="windowsphonepush-device_url-wrapper">';

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: WordPress Post Connector * Name: WordPress Post Connector
* Description: Post to WordPress (or anything else which uses blogger XMLRPC API) * Description: Post to WordPress (or anything else which uses blogger XMLRPC API)
@ -7,6 +6,7 @@
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike> * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function wppost_install() { function wppost_install() {
@ -41,7 +41,7 @@ function wppost_jot_nets(&$a,&$b) {
$wp_defpost = PConfig::get(local_user(),'wppost','post_by_default'); $wp_defpost = PConfig::get(local_user(),'wppost','post_by_default');
$selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : ''); $selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> ' $b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> '
. t('Post to Wordpress') . '</div>'; . L10n::t('Post to Wordpress') . '</div>';
} }
} }
@ -79,54 +79,54 @@ function wppost_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_wppost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_wppost_expanded\'); openClose(\'settings_wppost_inflated\');">'; $s .= '<span id="settings_wppost_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_wppost_expanded\'); openClose(\'settings_wppost_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/wordpress.png" /><h3 class="connector">'. t('Wordpress Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/wordpress.png" /><h3 class="connector">'. L10n::t('Wordpress Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_wppost_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_wppost_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_wppost_expanded\'); openClose(\'settings_wppost_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_wppost_expanded\'); openClose(\'settings_wppost_inflated\');">';
$s .= '<img class="connector'.$css.'" src="images/wordpress.png" /><h3 class="connector">'. t('Wordpress Export').'</h3>'; $s .= '<img class="connector'.$css.'" src="images/wordpress.png" /><h3 class="connector">'. L10n::t('Wordpress Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="wppost-enable-wrapper">'; $s .= '<div id="wppost-enable-wrapper">';
$s .= '<label id="wppost-enable-label" for="wppost-checkbox">' . t('Enable WordPress Post Addon') . '</label>'; $s .= '<label id="wppost-enable-label" for="wppost-checkbox">' . L10n::t('Enable WordPress Post Addon') . '</label>';
$s .= '<input id="wppost-checkbox" type="checkbox" name="wppost" value="1" ' . $checked . '/>'; $s .= '<input id="wppost-checkbox" type="checkbox" name="wppost" value="1" ' . $checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-username-wrapper">'; $s .= '<div id="wppost-username-wrapper">';
$s .= '<label id="wppost-username-label" for="wppost-username">' . t('WordPress username') . '</label>'; $s .= '<label id="wppost-username-label" for="wppost-username">' . L10n::t('WordPress username') . '</label>';
$s .= '<input id="wppost-username" type="text" name="wp_username" value="' . $wp_username . '" />'; $s .= '<input id="wppost-username" type="text" name="wp_username" value="' . $wp_username . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-password-wrapper">'; $s .= '<div id="wppost-password-wrapper">';
$s .= '<label id="wppost-password-label" for="wppost-password">' . t('WordPress password') . '</label>'; $s .= '<label id="wppost-password-label" for="wppost-password">' . L10n::t('WordPress password') . '</label>';
$s .= '<input id="wppost-password" type="password" name="wp_password" value="' . $wp_password . '" />'; $s .= '<input id="wppost-password" type="password" name="wp_password" value="' . $wp_password . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-blog-wrapper">'; $s .= '<div id="wppost-blog-wrapper">';
$s .= '<label id="wppost-blog-label" for="wppost-blog">' . t('WordPress API URL') . '</label>'; $s .= '<label id="wppost-blog-label" for="wppost-blog">' . L10n::t('WordPress API URL') . '</label>';
$s .= '<input id="wppost-blog" type="text" name="wp_blog" value="' . $wp_blog . '" />'; $s .= '<input id="wppost-blog" type="text" name="wp_blog" value="' . $wp_blog . '" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-bydefault-wrapper">'; $s .= '<div id="wppost-bydefault-wrapper">';
$s .= '<label id="wppost-bydefault-label" for="wppost-bydefault">' . t('Post to WordPress by default') . '</label>'; $s .= '<label id="wppost-bydefault-label" for="wppost-bydefault">' . L10n::t('Post to WordPress by default') . '</label>';
$s .= '<input id="wppost-bydefault" type="checkbox" name="wp_bydefault" value="1" ' . $def_checked . '/>'; $s .= '<input id="wppost-bydefault" type="checkbox" name="wp_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-backlink-wrapper">'; $s .= '<div id="wppost-backlink-wrapper">';
$s .= '<label id="wppost-backlink-label" for="wppost-backlink">' . t('Provide a backlink to the Friendica post') . '</label>'; $s .= '<label id="wppost-backlink-label" for="wppost-backlink">' . L10n::t('Provide a backlink to the Friendica post') . '</label>';
$s .= '<input id="wppost-backlink" type="checkbox" name="wp_backlink" value="1" ' . $back_checked . '/>'; $s .= '<input id="wppost-backlink" type="checkbox" name="wp_backlink" value="1" ' . $back_checked . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-backlinktext-wrapper">'; $s .= '<div id="wppost-backlinktext-wrapper">';
$s .= '<label id="wppost-backlinktext-label" for="wp_backlink_text">' . t('Text for the backlink, e.g. Read the original post and comment stream on Friendica.') . '</label>'; $s .= '<label id="wppost-backlinktext-label" for="wp_backlink_text">' . L10n::t('Text for the backlink, e.g. Read the original post and comment stream on Friendica.') . '</label>';
$s .= '<input id="wppost-backlinktext" type="text" name="wp_backlink_text" value="'. $wp_backlink_text.'" ' . $wp_backlink_text . '/>'; $s .= '<input id="wppost-backlinktext" type="text" name="wp_backlink_text" value="'. $wp_backlink_text.'" ' . $wp_backlink_text . '/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="wppost-shortcheck-wrapper">'; $s .= '<div id="wppost-shortcheck-wrapper">';
$s .= '<label id="wppost-shortcheck-label" for="wppost-shortcheck">' . t("Don't post messages that are too short") . '</label>'; $s .= '<label id="wppost-shortcheck-label" for="wppost-shortcheck">' . L10n::t("Don't post messages that are too short") . '</label>';
$s .= '<input id="wppost-shortcheck" type="checkbox" name="wp_shortcheck" value="1" '.$shortcheck_checked.'/>'; $s .= '<input id="wppost-shortcheck" type="checkbox" name="wp_shortcheck" value="1" '.$shortcheck_checked.'/>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="wppost-submit" name="wppost-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="wppost-submit" name="wppost-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
@ -215,7 +215,7 @@ function wppost_send(&$a,&$b) {
$wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog');
$wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text');
if ($wp_backlink_text == '') { if ($wp_backlink_text == '') {
$wp_backlink_text = t('Read the orig­i­nal post and com­ment stream on Friendica'); $wp_backlink_text = L10n::t('Read the orig­i­nal post and com­ment stream on Friendica');
} }
if($wp_username && $wp_password && $wp_blog) { if($wp_username && $wp_password && $wp_blog) {
@ -278,7 +278,7 @@ function wppost_send(&$a,&$b) {
} }
} }
$title = '<title>' . (($wptitle) ? $wptitle : t('Post from Friendica')) . '</title>'; $title = '<title>' . (($wptitle) ? $wptitle : L10n::t('Post from Friendica')) . '</title>';
$post = bbcode($b['body'], false, false, 4); $post = bbcode($b['body'], false, false, 4);
// If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it // If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it

View file

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Name: XMPP (Jabber) * Name: XMPP (Jabber)
* Description: Embedded XMPP (Jabber) client * Description: Embedded XMPP (Jabber) client
@ -9,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
function xmpp_install() function xmpp_install()
@ -36,7 +36,7 @@ function xmpp_addon_settings_post()
PConfig::set(local_user(), 'xmpp', 'individual', intval($_POST['xmpp_individual'])); PConfig::set(local_user(), 'xmpp', 'individual', intval($_POST['xmpp_individual']));
PConfig::set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy']); PConfig::set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy']);
info(t('XMPP settings updated.') . EOL); info(L10n::t('XMPP settings updated.') . EOL);
} }
function xmpp_addon_settings(App $a, &$s) function xmpp_addon_settings(App $a, &$s)
@ -61,26 +61,26 @@ function xmpp_addon_settings(App $a, &$s)
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<span id="settings_xmpp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">'; $s .= '<span id="settings_xmpp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">';
$s .= '<h3>' . t('XMPP-Chat (Jabber)') . '</h3>'; $s .= '<h3>' . L10n::t('XMPP-Chat (Jabber)') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_xmpp_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_xmpp_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_xmpp_expanded\'); openClose(\'settings_xmpp_inflated\');">';
$s .= '<h3>' . t('XMPP-Chat (Jabber)') . '</h3>'; $s .= '<h3>' . L10n::t('XMPP-Chat (Jabber)') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="xmpp-settings-wrapper">'; $s .= '<div id="xmpp-settings-wrapper">';
$s .= '<label id="xmpp-enabled-label" for="xmpp-enabled">' . t('Enable Webchat') . '</label>'; $s .= '<label id="xmpp-enabled-label" for="xmpp-enabled">' . L10n::t('Enable Webchat') . '</label>';
$s .= '<input id="xmpp-enabled" type="checkbox" name="xmpp_enabled" value="1" ' . $enabled_checked . '/>'; $s .= '<input id="xmpp-enabled" type="checkbox" name="xmpp_enabled" value="1" ' . $enabled_checked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
if (Config::get("xmpp", "central_userbase")) { if (Config::get("xmpp", "central_userbase")) {
$s .= '<label id="xmpp-individual-label" for="xmpp-individual">' . t('Individual Credentials') . '</label>'; $s .= '<label id="xmpp-individual-label" for="xmpp-individual">' . L10n::t('Individual Credentials') . '</label>';
$s .= '<input id="xmpp-individual" type="checkbox" name="xmpp_individual" value="1" ' . $individual_checked . '/>'; $s .= '<input id="xmpp-individual" type="checkbox" name="xmpp_individual" value="1" ' . $individual_checked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
} }
if (!Config::get("xmpp", "central_userbase") || PConfig::get(local_user(), "xmpp", "individual")) { if (!Config::get("xmpp", "central_userbase") || PConfig::get(local_user(), "xmpp", "individual")) {
$s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">' . t('Jabber BOSH host') . '</label>'; $s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">' . L10n::t('Jabber BOSH host') . '</label>';
$s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="' . $bosh_proxy . '" />'; $s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="' . $bosh_proxy . '" />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
} }
@ -89,7 +89,7 @@ function xmpp_addon_settings(App $a, &$s)
/* provide a submit button */ /* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="xmpp-settings-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="xmpp-settings-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
} }
function xmpp_login() function xmpp_login()
@ -105,9 +105,9 @@ function xmpp_addon_admin(App $a, &$o)
$t = get_markup_template("admin.tpl", "addon/xmpp/"); $t = get_markup_template("admin.tpl", "addon/xmpp/");
$o = replace_macros($t, [ $o = replace_macros($t, [
'$submit' => t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$bosh_proxy' => ['bosh_proxy', t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''], '$bosh_proxy' => ['bosh_proxy', L10n::t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''],
'$central_userbase' => ['central_userbase', t('Use central userbase'), Config::get('xmpp', 'central_userbase'), t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')], '$central_userbase' => ['central_userbase', L10n::t('Use central userbase'), Config::get('xmpp', 'central_userbase'), L10n::t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')],
]); ]);
} }
@ -117,7 +117,7 @@ function xmpp_addon_admin_post()
$central_userbase = ((x($_POST, 'central_userbase')) ? intval($_POST['central_userbase']) : false); $central_userbase = ((x($_POST, 'central_userbase')) ? intval($_POST['central_userbase']) : false);
Config::set('xmpp', 'bosh_proxy', $bosh_proxy); Config::set('xmpp', 'bosh_proxy', $bosh_proxy);
Config::set('xmpp', 'central_userbase', $central_userbase); Config::set('xmpp', 'central_userbase', $central_userbase);
info(t('Settings updated.') . EOL); info(L10n::t('Settings updated.') . EOL);
} }
function xmpp_script(App $a) function xmpp_script(App $a)

View file

@ -1,6 +1,4 @@
<?php <?php
/** /**
* Name: Yourls * Name: Yourls
* Description: Defines a YourLS url shortener for the Statusnet & Twitter addons * Description: Defines a YourLS url shortener for the Statusnet & Twitter addons
@ -10,6 +8,7 @@
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n;
function yourls_install() { function yourls_install() {
Addon::registerHook('addon_settings', 'addon/yourls/yourls.php', 'yourls_addon_settings'); Addon::registerHook('addon_settings', 'addon/yourls/yourls.php', 'yourls_addon_settings');
@ -54,34 +53,34 @@ function yourls_addon_settings(&$a,&$s) {
$yourls_ssl = Config::get('yourls', 'ssl1'); $yourls_ssl = Config::get('yourls', 'ssl1');
$s .= '<span id="settings_yourls_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">'; $s .= '<span id="settings_yourls_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">';
$s .= '<h3>' . t('YourLS') . '</h3>'; $s .= '<h3>' . L10n::t('YourLS') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="settings_yourls_expanded" class="settings-block" style="display: none;">'; $s .= '<div id="settings_yourls_expanded" class="settings-block" style="display: none;">';
$s .= '<span class="fakelink" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">'; $s .= '<span class="fakelink" onclick="openClose(\'settings_yourls_expanded\'); openClose(\'settings_yourls_inflated\');">';
$s .= '<h3>' . t('YourLS') . '</h3>'; $s .= '<h3>' . L10n::t('YourLS') . '</h3>';
$s .= '</span>'; $s .= '</span>';
$s .= '<div id="yourls-url-wrapper">'; $s .= '<div id="yourls-url-wrapper">';
$s .= '<label id="yourls-url-label" for="yourls-url">' . t('URL: http://') . '</label>'; $s .= '<label id="yourls-url-label" for="yourls-url">' . L10n::t('URL: http://') . '</label>';
$s .= '<input id="yourls-url" type="text" name="yourls_url" value="' . $yourls_url .'" />'; $s .= '<input id="yourls-url" type="text" name="yourls_url" value="' . $yourls_url .'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="yourls-username-wrapper">'; $s .= '<div id="yourls-username-wrapper">';
$s .= '<label id="yourls-username-label" for="yourls-username">' . t('Username:') . '</label>'; $s .= '<label id="yourls-username-label" for="yourls-username">' . L10n::t('Username:') . '</label>';
$s .= '<input id="yourls-username" type="text" name="yourls_username" value="' . $yourls_username .'" />'; $s .= '<input id="yourls-username" type="text" name="yourls_username" value="' . $yourls_username .'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="yourls-password-wrapper">'; $s .= '<div id="yourls-password-wrapper">';
$s .= '<label id="yourls-password-label" for="yourls-password">' . t('Password:') . '</label>'; $s .= '<label id="yourls-password-label" for="yourls-password">' . L10n::t('Password:') . '</label>';
$s .= '<input id="yourls-password" type="password" name="yourls_password" value="' . $yourls_password .'" />'; $s .= '<input id="yourls-password" type="password" name="yourls_password" value="' . $yourls_password .'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div id="yourls-ssl-wrapper">'; $s .= '<div id="yourls-ssl-wrapper">';
$s .= '<label id="yourls-ssl-label" for="yourls-ssl">' . t('Use SSL ') . '</label>'; $s .= '<label id="yourls-ssl-label" for="yourls-ssl">' . L10n::t('Use SSL ') . '</label>';
$s .= '<input id="yourls-ssl" type="checkbox" name="yourls_ssl" value="1" ' . $ssl_checked . ' />'; $s .= '<input id="yourls-ssl" type="checkbox" name="yourls_ssl" value="1" ' . $ssl_checked . ' />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="yourls-submit" name="yourls-submit" class="settings-submit" value="' . t('Save Settings') . '" /></div></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="yourls-submit" name="yourls-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
return; return;
@ -97,6 +96,6 @@ function yourls_addon_settings_post(&$a,&$b) {
Config::set('yourls','username1',trim($_POST['yourls_username'])); Config::set('yourls','username1',trim($_POST['yourls_username']));
Config::set('yourls','password1',trim($_POST['yourls_password'])); Config::set('yourls','password1',trim($_POST['yourls_password']));
Config::set('yourls','ssl1',intval($_POST['yourls_ssl'])); Config::set('yourls','ssl1',intval($_POST['yourls_ssl']));
info( t('yourls Settings saved.') . EOL); info(L10n::t('yourls Settings saved.') . EOL);
} }
} }