DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:favoris

favoris Plugin

Compatible with DokuWiki

Rincewind, Angua

plugin Displays your favorite pages (most visited) and let you set them up (fr: Affiche les liens vers vos pages favorites (les plus visitees) et vous permet de les gerer)

Last updated on
2009-03-04
Provides
Syntax, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with bookmark, listing, navigation, users

Description

  • syntax: displays the list of your recent and favorite pages
  • action: handle the favorite tracking cookies each time you visit a page
  • French and English. It's easy to add you own language.
  • This plugin needs cookies to work.

Usage

  • Add ~~FAVORIS~~ to insert your favorites list on a page (in your personal sidebar, for example)
  • Double-click to make the controls appear (or don't move the mouse for 2 seconds over the favorites area)
  • You can:
    • Reset the visit count for a page
    • Exclude a page from the favorite tracking
    • Reset all the visit counts
    • Disable favorite tracking
    • View the excluded pages and “include” them back
    • Choose how many recent and favorite pages you want to display (see the little configuration panel)
  • Screenshots

The list

The list when the controls are displayed The list and the excluded pages and the small configuration panel

  • When the snap plugin is installed, a link “My favorites mosaic »” is shown that allows you to display your favorites as thumbnails (like in Google Chrome ;-))

La mosaïque

Version history

  • 2008-09-24: first one!
  • 2008-09-25: corrects a warning (Missing argument 1 for Doku_Renderer_xhtml::listitem_open()). Thanks to Bertrand.
  • 2008-09-29: displays also recent pages. Added a small configuration panel. “Reset all” now maintains excluded pages list.
  • 2008-10-17: if the snap plugin is installed, displays a link to the “Favorites mosaic” (like in Google Chrome ;-))
  • 2008-10-17: new style for not existing pages
  • 2009-03-04: checks if the “pagelist” and “snap” plugins are installed before trying to load them. Label change for “Recently visited pages”.

Discussion

  • Tell me…
    • One of the best plugin on my opinion! May I suggest “Pages récemment visitées” comme texte au lieu de “Pages récentes”? Si j'ai bien compris le fonctionnement, il s'agit des pages les plus récemment visitées et pas des pages les plus récemment créées?
      • This will be corrected in a coming soon new versionThis has been corrected with version 2009-03-04. Thank you for your message.

Patch to show page titles

Nice plugin! From the code it appears favoris will use the pagelist if installed to generate titles for listed pages. But if it's not installed it just displays page filenames. It can be problematic when many pages have the same filename (such as start pages in namespaces). I hacked plugins/favoris/syntax.php to generate titles from headings even without pagelist by replacing

syntax.php (old)
 function donneLien($page, $title="") {
      if (!plugin_isdisabled('pagelist')) $pagelist = plugin_load('helper', 'pagelist');
 
      if (!$pagelist) {
        $titrePage=explode(":",$page);
        $titrePage=$titrePage[sizeof($titrePage)-1];
        $titrePage=str_replace('_',' ',$titrePage);
      }
      else {
        $pagelist->page['id']=$page;
        $pagelist->page['exists'] = 1;
        $pagelist->_meta=NULL;
        $titrePage = $pagelist->_getMeta('title');
        if (!$titrePage) $titrePage = str_replace('_', ' ', noNS($page));
        $titrePage = hsc($titrePage);
     }
     if (@file_exists(fullpath(wikiFN($page)))) return "<a href='doku.php?id=".$page."' class='wikilink1' style='font-weight: lighter;' title='$page".$title."'>$titrePage</a>";
     else return "<a href='doku.php?id=".$page."' class='wikilink2' style='font-weight: lighter;' title='$page".$title."' rel='nofollow'>$titrePage</a>";
   }

with

syntax.php (new)
 function donneLien($page, $title="") {
      $titrePage=p_get_first_heading($page);
      if (!$titrePage) {
 
      if (!plugin_isdisabled('pagelist')) $pagelist = plugin_load('helper', 'pagelist');
 
      if (!$pagelist) {
        $titrePage=explode(":",$page);
        $titrePage=$titrePage[sizeof($titrePage)-1];
        $titrePage=str_replace('_',' ',$titrePage);
      }
      else {
        $pagelist->page['id']=$page;
        $pagelist->page['exists'] = 1;
        $pagelist->_meta=NULL;
        $titrePage = $pagelist->_getMeta('title');
        if (!$titrePage) $titrePage = str_replace('_', ' ', noNS($page));
        $titrePage = hsc($titrePage);
     }
     }
     if (@file_exists(fullpath(wikiFN($page)))) return "<a href='doku.php?id=".$page."' class='wikilink1' style='font-weight: lighter;' title='$page".$title."'>$titrePage</a>";
     else return "<a href='doku.php?id=".$page."' class='wikilink2' style='font-weight: lighter;' title='$page".$title."' rel='nofollow'>$titrePage</a>";
   }

German Translate

lang.php
		<?php
$lang['fav_description']      = "Zeigt Ihre Lieblings-Seiten (meist besucht)";
$lang['fav_desact']           = "Favoriten-Erkennung ist deaktiviert.";
$lang['fav_activer']          = "Zum aktivieren hier klicken";
$lang['fav_cookies']          = "(Diese Erkennung ist cookie gesteuert)";
$lang['fav_visites']          = "Besuch(e)";
$lang['fav_reset']            = "Besuchszahl dieser Seite zurücksetzen";
$lang['fav_exclure']          = "Diese Seite von den Favoriten ausschließen.";
$lang['fav_voircacher']       = "Anzeigen/verstecken ausgeschlossener Seiten u. Konfiguration";
$lang['fav_inclure']          = "Diese Seite zu den Favoriten hinzufügen";
$lang['fav_rafraichir']       = "Atkualisieren (aktuelle Seite neu laden)";
$lang['fav_confirmation']     = "Möchten Sie die Favoriten-Erkennung wirklich deaktivieren?\\n(Ihre Favoriten-Liste wird gelöscht)";
$lang['fav_desactiver']       = "Deaktiviert Favoriten-Erkennung";
$lang['fav_pasencore']        = "Im Moment haben Sie noch keine Favoriten. Kontrollieren Sie ob Ihr Browser Cookies erlaubt oder warten Sie noch etwas.";
$lang['fav_flotter']          = "Um das Konfigurationsfenster zu öffnen doppelklicken Sie, oder bewegen Sie die Maus für 2 Sekunden nicht.";
$lang['fav_confResetAll']     = "Alle Besuchszahlen zurücksetzen?";
$lang['fav_resetall']         = "Setzt alle Besuchszahlen zurück";
$lang['fav_prec']             = "Kürzlich besucht";
$lang['fav_pfav']             = "Favoriten";
$lang['fav_config']           = "Konfiguration";
$lang['fav_afficher']         = "Zeige";
$lang['fav_conf_prec']        = "Kürzlich besuchte Seite(n)";
$lang['fav_conf_pfav']        = "Favoriten";
$lang['fav_sauver']           = "Speichern";
 
$lang['fav_snapnotfound']    = "Snap helper nicht gefunden!";
$lang['fav_pbsnap']          = "<b>SNAP:</b> Problem while snapping ";
$lang['fav_mosaique']        = "My favorites mosaic";

400 Bad Request error

Thanks for this excellent plugin! I've been using it for a couple years now. Today I created several deeply nested page (about 100 character long namespace strings) and after saving one, I couldn't access my wiki! I just got a “400 Bad Request - request header or cookie too large” error, regardless of which page I tried to load. When I deleted (only) the Favoris cookies I could access the site again. I guess that Favoris is overfilling the cookies and causing problems? If so, is it possible to insert an “overflow” check to prevent the error? I'm running the latest Favoris (2009-03-04) on Weatherwax and my browser is Firefox 24. Thanks! — Rik Blok 2013/10/21 03:35

Patch for a wiki farm setup

--- action.php.ORIG	2009-03-03 17:25:05.000000000 +0100
+++ action.php	2016-03-15 11:22:42.419287081 +0100
@@ -42,6 +42,8 @@
     function _update_cookie(&$event, $param) {
         global $INFO;
 
+	$cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'];
+
         if($event->data == 'snapfavoris') {
           $event->preventDefault();
         }
@@ -55,7 +57,7 @@
           //Si on ne souhaite pas suivre les favoris
           if ($fav['off']==1) {
             //On efface les eventuels cookies existants (sauf off)
-            foreach ($_COOKIE['favoris'] as $page => $cpt) if ($page != "off") setCookie("favoris[$page]", "", time()-3600, '/');
+            foreach ($_COOKIE['favoris'] as $page => $cpt) if ($page != "off") setCookie("favoris[$page]", "", time()-3600, $cookieDir, '', ($conf['securecookie'] && is_ssl()));
             return;
           }
 
@@ -64,7 +66,7 @@
             //On efface tous les cookies (y compris off)
             foreach ($_COOKIE['favoris'] as $page => $cpt) {
               list($cpt, $date)=explode(";",$cpt);
-              if ($cpt != "-1") setCookie("favoris[$page]", "", time()-3600, '/');
+              if ($cpt != "-1") setCookie("favoris[$page]", "", time()-3600, $cookieDir, '', ($conf['securecookie'] && is_ssl()));
             }
             return;
           }
@@ -82,7 +84,7 @@
         else $cpt=1;
 
         //On positionne le cookie
-        setCookie("favoris[".$INFO['id']."]","$cpt;".time(), time()+60*60*24*7, '/');
+	setCookie("favoris[".$INFO['id']."]","$cpt;".time(), time()+60*60*24*7, $cookieDir, '', ($conf['securecookie'] && is_ssl()));
     }
plugin/favoris.txt · Last modified: 2023-10-30 23:12 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki