芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/canaldegap.fr_old/plugins/function.cms_selflink.php
0 ) ) { $target=' target="'.$params['target'].'" '; } $external_text = '(external link)'; if ( isset($params['ext_info']) ) { $external_text ='( '.$params['ext_info'].' )'; } return '
'.$text.'
'.$external_text.'
'; } $urlparams = ''; if ( isset($params['urlparams']) && ( strlen($params['urlparams'] > 0 ) ) ) { $urlparams =$params['urlparams']; } /* LeisureLarry - Changed if statement */ if (isset($params['page']) or isset($params['href'])) { /* LeisureLarry - Begin */ if (isset($params['href'])) { $page = $params['href']; } /* LeisureLarry - End */ else { $page = $params['page']; } $name = $page; # check if the page exists in the db $manager =& $gCms->GetHierarchyManager(); $node =& $manager->sureGetNodeByAlias($page); if (!isset($node)) return; $content =& $node->GetContent(); if ($content !== FALSE && is_object($content)) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); //mbv - 21-06-2005 $url = $content->GetUrl(); $menu_text = $content->MenuText(); $titleattr = $content->TitleAttribute(); } /* Mod by Nemesis */ if (isset($params['anchorlink'])) { $url .= '#' . ltrim($params['anchorlink'], '#'); } if (isset($params['urlparam'])) { $url .= trim($params['urlparam']); } /* End mod Nemesis */ $Prev_label = ""; $Next_label = ""; $Anchor_label = ""; //*Russ $Parent_label = "Parent page: "; //uplink } elseif (isset($params['dir'])) // this part is by mbv built on a proposal by 100rk { /* Russ - Begin */ if (isset($params['anchorlink'])) { $anchorlink = ltrim($params['anchorlink'], '#'); //Param to set anchor link } /* Russ - End */ $lang = get_site_preference('frontendlang','en'); if (isset($params['lang'])) { $lang = $params['lang']; } switch ($lang) { case 'dk': case 'da': case 'da_DK': $Prev_label = "Forrige side: "; $Next_label = "Næste side: "; break; case 'nl': case 'nl_NL': $Prev_label = "Vorige pagina: "; $Next_label = "Volgende pagina: "; $Parent_label = "Bovenliggende pagina: "; // uplink break; case 'fr': case 'fr_FR': $Prev_label = "Page précédente : "; $Next_label = "Page suivante : "; $Parent_label = "Page ascendante : "; //uplink break; case 'no': case 'nb_NO': $Prev_label = "Forrige side : "; $Next_label = "Neste side: "; $Parent_label = "Side opp: "; //uplink break; case '0': $Prev_label = ""; $Next_label = ""; break; case 'en': default: $Prev_label = "Previous page: "; $Next_label = "Next page: "; $Parent_label = "Parent page: "; //uplink break; } $condition = $order_by = false; switch (strtolower($params['dir'])) { case 'next': $condition = '>'; $order_by = 'hierarchy'; $label=$Next_label; break; case 'prev': case 'previous': $condition = '<'; $order_by = 'hierarchy DESC'; $label=$Prev_label; break; case 'anchor': //* Start Russ addition $condition = '^'; $order_by = 'something'; $label=''; //No label needed break;//* End Russ addition case 'start': $condition = '-'; $order_by = 'something'; $label = ''; break; case 'up': //* Start uplink $condition = '|'; $order_by = '-'; $label=''; break; //* End uplink } if ($condition && $order_by) { global $gCms; $hm =& $gCms->GetHierarchyManager(); $flatcontent = array(); if ($condition != '|') // uplink (we don't need the flatcontent for an uplink) { #return ''; $flatcontent =& $hm->getFlatList(); $contentops =& $gCms->GetContentOperations(); $defaultid = $contentops->GetDefaultPageID(); $number = 0; for ($i = 0; $i < count($flatcontent); $i++) { if ($condition == '-') { if ($flatcontent[$i]->getTag() == $defaultid) { $number = $i; break; } } else if ($flatcontent[$i]->getTag() == $gCms->variables['content_id']) { $number = $i; break; } } } //* uplink addition if ($condition == '<') { if ($number > 0) { for ($i = $number - 1; $i >= 0; $i--) { $content =& $flatcontent[$i]->getContent(); if (isset($content) && $content != NULL) { if ($content->Active() && $content->ShowInMenu() && $content->HasUsableLink()) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); $menu_text = $content->MenuText(); $url = $content->GetURL(); $titleattr = $content->TitleAttribute(); break; } } else { break; } } } } else if ($condition == '>') { if ($number < count($flatcontent)) { for ($i = $number + 1; $i < count($flatcontent); $i++) { $content =& $flatcontent[$i]->getContent(); if(isset($content) && $content != NULL) { if ($content->Active() && $content->ShowInMenu() && $content->HasUsableLink()) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); $menu_text = $content->MenuText(); $url = $content->GetURL(); $titleattr = $content->TitleAttribute(); break; } } else { break; } } } } else if ($condition == '^') //* Start Russ addition { if ($number < count($flatcontent)) { for ($i = $number; $i < count($flatcontent); $i++) { $content =& $flatcontent[$i]->getContent(); if (isset($content)) { if ($content->Active() && $content->ShowInMenu() && $content->HasUsableLink()) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); $menu_text = $content->MenuText(); $url = $content->GetURL().'#'.$anchorlink; //set as Param $titleattr = $content->TitleAttribute(); break; } } else { break; } } } } //* End Russ addition else if ($condition == '|') //* Start uplink { $node =& $hm->getNodeById($gCms->variables['content_id']); $node =& $node->getParentNode(); // print_r($node); if (!isset($node)) return; $content =& $node->GetContent(); if ($content != FALSE) { if ($content->Active() && $content->HasUsableLink()) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); $menu_text = $content->MenuText(); $url = $content->GetURL(); $titleattr = $content->TitleAttribute(); } } } //* End uplink else if ($condition == '-') { $content =& $flatcontent[$number]->getContent(); if (isset($content)) { $pageid = $content->Id(); $alias = $content->Alias(); $name = $content->Name(); $menu_text = $content->MenuText(); $url = $content->GetURL(); $titleattr = $content->TitleAttribute(); } } } unset($condition); unset($order_by); } // end of next-prev code if (isset($params['label'])) { $label = $params['label']; $label = cms_htmlentities($label); } else { if (!isset($label)) { $label = ''; } } $result = ""; $title = (isset($name)) ? $name : ''; if( isset($params['title']) ) $title = $params['title']; else if( !empty($titleattr) ) $title = $titleattr; $title = cms_htmlentities($title); /* LeisureLarry - Changes if statement */ if (($url != "") and !isset($params['href'])) { if ($rellink && isset($params['dir'])) { $result .= '
'; } else { if (! isset($params['label_side']) || $params['label_side'] == 'left') { $result .= $label; } $result .= '
"; if (! (isset($params['imageonly']) && $params['imageonly'])) { $result .= " $linktext"; } } else { $result .= $linktext; } $result .= ''; if (isset($params['label_side']) && $params['label_side'] == 'right') { $result .= $label; } } /* LeisureLarry - Begin */ } elseif (isset($params['href'])) { $result .= $url; /* LeisureLarry - End */ } else { /* $result .= ""; if (isset($params['text'])) { $result .= $params['text']; } */ } if( isset($params['assign']) ) { $smarty->assign($params['assign'],$result); return; } return $result; } function smarty_cms_help_function_cms_selflink() { echo lang('help_function_cms_selflink'); } function smarty_cms_about_function_cms_selflink() { echo lang('about_function_cms_selflink'); } # vim:ts=4 sw=4 noet ?>