@@ -4478,8 +4478,9 @@ function group_link($group_name, $linking = true, $add_icon = true)
4478
4478
* Add spaces to WikiWords (if config parameter show_spaces = 1) and replace
4479
4479
* relative path (/ !/ ../) to icons RootLinkIcon, SubLinkIcon, UpLinkIcon
4480
4480
*
4481
- * @param string $text Text with WikiWords
4482
- * @return string Text with Wiki Words
4481
+ * @param string $text Text with WikiWords
4482
+ *
4483
+ * @return string Text with Wiki Words
4483
4484
*/
4484
4485
function add_spaces ($ text ): ?string
4485
4486
{
@@ -6693,8 +6694,8 @@ function get_menu_default()
6693
6694
return (!isset ($ this ->sess ->menu_default )) || $ this ->sess ->menu_default ;
6694
6695
}
6695
6696
6696
- // TODO: do not add
6697
- // - comments, system pages, methodes,
6697
+ // TODO:
6698
+ // - comments, system pages, methods (?)
6698
6699
// - url arguments ?profile= ['page_id', 'arguments']
6699
6700
// - add parameter for trail size in user settings ?
6700
6701
// parse only once, without included pages (avoid call in run function!)
@@ -6709,23 +6710,25 @@ function set_user_trail($size = 5): void
6709
6710
{
6710
6711
$ count = count ($ this ->sess ->user_trail );
6711
6712
6712
- if (isset ($ this ->sess ->user_trail [$ count - 1 ][0 ])
6713
- && $ this ->sess ->user_trail [$ count - 1 ][0 ] == $ page_id )
6714
- {
6715
- // nothing
6716
- }
6717
- else
6713
+ if (!(isset ($ this ->sess ->user_trail [$ count - 1 ][0 ])
6714
+ && $ this ->sess ->user_trail [$ count - 1 ][0 ] == $ page_id ))
6718
6715
{
6719
- if (count ($ this ->sess ->user_trail ) > $ size )
6716
+ // this is about navigation, remove double entries
6717
+ foreach ($ this ->sess ->user_trail as $ link )
6720
6718
{
6721
- $ this ->sess ->user_trail = array_slice ($ this ->sess ->user_trail , -$ size );
6719
+ if ($ page_id != $ link [0 ])
6720
+ {
6721
+ $ trail [] = $ link ;
6722
+ }
6722
6723
}
6723
6724
6724
- $ _user_trail [-1 ] = [$ page_id , $ this ->page ['tag ' ], $ this ->page ['title ' ]];
6725
- $ user_trail = $ this ->sess ->user_trail + $ _user_trail ;
6726
- $ user_trail = array_values ($ user_trail );
6725
+ if (count ($ trail ) > $ size )
6726
+ {
6727
+ $ trail = array_slice ($ trail , -$ size );
6728
+ }
6727
6729
6728
- $ this ->sess ->user_trail = $ user_trail ;
6730
+ $ trail [-1 ] = [$ page_id , $ this ->page ['tag ' ], $ this ->page ['title ' ]];
6731
+ $ this ->sess ->user_trail = $ trail ;
6729
6732
}
6730
6733
}
6731
6734
else
@@ -6738,24 +6741,23 @@ function set_user_trail($size = 5): void
6738
6741
// user trail navigation
6739
6742
// call this function in your theme header or footer
6740
6743
// $separator = > »
6741
- function get_user_trail ($ titles = false , $ separator = ' > ' , $ linking = true , $ size = null ): string
6744
+ function get_user_trail ($ title = false , $ separator = ' > ' , $ linking = true , $ size = null ): string
6742
6745
{
6743
6746
// don't call this inside the run function, it will also writes all included pages
6744
6747
// in the user trail because the engine parses them before it includes them
6745
6748
$ this ->set_user_trail ($ size );
6746
6749
6747
6750
if (isset ($ this ->sess ->user_trail ))
6748
6751
{
6749
- $ links = $ this ->sess ->user_trail ;
6750
6752
$ result = '' ;
6751
6753
$ size = (int ) $ size ;
6752
6754
$ i = 0 ;
6753
6755
6754
- foreach ($ links as $ link )
6756
+ foreach ($ this -> sess -> user_trail as $ link )
6755
6757
{
6756
6758
if ($ i < $ size && $ this ->page ['page_id ' ] != $ link [0 ])
6757
6759
{
6758
- if (!$ titles )
6760
+ if (!$ title )
6759
6761
{
6760
6762
$ result .= $ this ->link ($ link [1 ], '' , $ link [1 ]) . $ separator ;
6761
6763
}
@@ -6772,14 +6774,7 @@ function get_user_trail($titles = false, $separator = ' > ', $linking = true,
6772
6774
$ i ++;
6773
6775
}
6774
6776
6775
- if (!$ titles )
6776
- {
6777
- $ result .= $ this ->page ['tag ' ];
6778
- }
6779
- else
6780
- {
6781
- $ result .= $ this ->page ['title ' ];
6782
- }
6777
+ $ result .= $ title ? $ this ->page ['title ' ] : $ this ->page ['tag ' ];
6783
6778
6784
6779
return $ result ;
6785
6780
}
@@ -7350,13 +7345,15 @@ function get_page_path($tag = '', $titles = false, $separator = '/', $linking =
7350
7345
continue ;
7351
7346
}
7352
7347
7348
+ $ item = $ titles ? $ this ->get_page_title ($ link ) : $ step ;
7349
+
7353
7350
if ($ linking && $ link != $ this ->tag )
7354
7351
{
7355
- $ item = $ this ->link ($ link , '' , ( $ titles ? $ this -> get_page_title ( $ link ) : $ step ) );
7352
+ $ item = $ this ->link ($ link , '' , $ item );
7356
7353
}
7357
7354
else
7358
7355
{
7359
- $ item = $ titles ? $ this ->get_page_title ( $ link ) : $ step ;
7356
+ $ item = $ this ->add_spaces ( $ item ) ;
7360
7357
}
7361
7358
7362
7359
$ result [] = '<bdi> ' . $ item . '</bdi> ' ;
0 commit comments