====== favoris Plugin ====== ---- plugin ---- description: 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) author : Etienne M. email : emauvaisfr@yahoo.fr type : action, syntax lastupdate : 2009-03-04 compatible : Rincewind, Angua depends : conflicts : similar : tags : users, bookmark, navigation, listing downloadurl: http://emauvaisfr.free.fr/dokuwiki/favoris.tar.gz bugtracker : sourcerepo : donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=79ZVTRTJ52DDY&lc=FR&item_name=Plugin%20dokuwiki%20%28Etienne%20M%2e%29¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted ---- ===== 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 {{http://emauvais.multimania.com/dokuwiki/favoris_01.png|The list }} {{http://emauvais.multimania.com/dokuwiki/favoris_02.png|The list when the controls are displayed}} {{http://emauvais.multimania.com/dokuwiki/favoris_03.png|The list and the excluded pages and the small configuration panel}} * When the [[plugin:snap|snap plugin]] is installed, a link "My favorites mosaic >>" is shown that allows you to display your favorites as thumbnails (like in Google Chrome ;-)) {{http://emauvais.multimania.com/dokuwiki/favoris_04.png|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 [[plugin:snap|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 [[plugin: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 [[plugin:pagelist]] by replacing 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 "$titrePage"; else return "$titrePage"; } with 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 "$titrePage"; else return "$titrePage"; } ==== German Translate ==== SNAP: 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! --- [[user>rikblok|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())); }