Browse Source

add optional side panels hiding

master
ivan 2 years ago
parent
commit
b2c971ce2a
  1. 2
      link/lang/de/strings.php
  2. 1
      link/lang/es/strings.php
  3. 1
      link/lang/fr/strings.php
  4. 1
      link/lang/it/strings.php
  5. 1
      link/lang/ru/strings.php
  6. 19
      link/link.php
  7. 1
      link/view/tpl/admin.tpl

2
link/lang/de/strings.php

@ -2,3 +2,5 @@
App::$strings["Link on Hub"] = "Link auf dem Hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Zeige \"Link auf dem Hub\" im Dropdown-Menü";
App::$strings["Hide side panels on the link page"] = "Seitenwände auf der Linkseite ausblenden";

1
link/lang/es/strings.php

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Enlazar con la entrada en el hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostrar \"Enlazar con la entrada en el hub\" en el menú desplegable";
App::$strings["Hide side panels on the link page"] = "Ocultar los paneles laterales en la página de enlaces";

1
link/lang/fr/strings.php

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Lien sur le Hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Afficher \"Lien sur le Hub\" dans le menu déroulant";
App::$strings["Hide side panels on the link page"] = "Masquer les panneaux latéraux sur la page de liens";

1
link/lang/it/strings.php

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Link al hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostra \"Link al hub\" nel menu a tendina";
App::$strings["Hide side panels on the link page"] = "Nascondere i pannelli laterali nella pagina dei link";

1
link/lang/ru/strings.php

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Ссылка на хабе";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Показывать \"Ссылку на хабе\" в выпадающем меню";
App::$strings["Hide side panels on the link page"] = "Скрывать боковые панели на странице ссылки";

19
link/link.php

@ -2,7 +2,7 @@
/**
* Name: Link
* Description: Using short links on whole hub
* Version: 0.67
* Version: 0.69
* Author: ivan zlax <@zlax@ussr.win>
* Maintainer: ivan zlax <@zlax@ussr.win>
*/
@ -15,12 +15,15 @@ function link_load() {
Route::register('addon/link/Mod_Link.php','link');
if (get_config('link','linkonhub'))
register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
if (get_config('link','hideasides'))
register_hook('page_header', 'addon/link/link.php', 'hideasides_header');
set_config('link','linkenabled',1);
}
function link_unload() {
Route::unregister('addon/link/Mod_Link.php','link');
unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
unregister_hook('page_header', 'addon/link/link.php', 'hideasides_header');
del_config('link','linkenabled');
}
@ -28,16 +31,22 @@ function link_plugin_admin(&$a,&$o) {
$t = get_markup_template( "admin.tpl", "addon/link/" );
$o = replace_macros($t, array(
'$submit' => t('Submit'),
'$hideasides' => array('hideasides', t('Hide side panels on the link page'), get_config('link', 'hideasides')),
'$linkonhub' => array('linkonhub', t('Show "Link on Hub" in the dropdown menu'), get_config('link', 'linkonhub')),
));
}
function link_plugin_admin_post(&$a) {
set_config('link','linkonhub',trim($_POST['linkonhub']));
set_config('link','hideasides',trim($_POST['hideasides']));
if (get_config('link','linkonhub'))
register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
else
unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
if (get_config('link','hideasides'))
register_hook('page_header', 'addon/link/link.php', 'hideasides_header');
else
unregister_hook('page_header', 'addon/link/link.php', 'hideasides_header');
info( t('Settings updated.') . EOL );
}
@ -47,3 +56,11 @@ function dropdown_link(&$extras) {
$arr['dropdown_extras'] .= '<a class="dropdown-item" href="'.z_root().'/link/'.$item_id.'" title="'.t('Link on Hub').'" class="u-url"><i class="generic-icons-nav fa fa-fw fa-link"></i>'.t('Link on Hub').'</a>';
$extras = $arr;
}
function hideasides_header($a, &$b) {
$querystr = stristr(App::$query_string, '/', true);
if ($querystr == "link") {
$addScriptTag = "<style>#region_1 { display: none; } #region_3 { display: none; }</style>\r\n";
App::$page['htmlhead'] .= $addScriptTag;
}
}

1
link/view/tpl/admin.tpl

@ -1,2 +1,3 @@
{{include file="field_checkbox.tpl" field=$linkonhub}}
{{include file="field_checkbox.tpl" field=$hideasides}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>

Loading…
Cancel
Save