<commit_before><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

include_once("tikihelplib.php");

class Breadcrumb
{
	var $title;
	var $description;
	var $url;
	var $helpUrl;
	var $helpDescription;

	function Breadcrumb($title, $desc='', $url='', $helpurl='', $helpdesc='') {
                if ($title == '') {
		    $this->title = 'Home';
		} else {
		    $this->title = $title;
		}
		$this->description = $desc;
		$this->url = $url;
		$this->helpUrl = $helpurl;
		$this->helpDescription = $helpdesc;
        }
/* end of class */
}

/* static */
function breadcrumb_buildHeadTitle($crumbs) {
	global $prefs;
    if( _is_assoc($crumbs) ) {
        return false;
    }
    if( is_array($crumbs) ) {
        $ret = array();
        foreach($crumbs as $crumb) {
            $ret[] = breadcrumb_buildHeadTitle($crumb);
        }
        return implode(" : ", $ret);
	} elseif ($prefs['site_title_breadcrumb'] == 'desc') {
		return $crumbs->description;
    } else {
        return htmlspecialchars($crumbs->title);
    }
}

/**
 *  @param crumbs array of breadcrumb instances
 *  @param loc where the description will be used: {site|page} site header or page header
 */
/* static */
function breadcrumb_buildTrail($crumbs, $loc) {
    global $prefs, $info;
    if($prefs['feature_breadcrumbs'] == 'y') {
        if ($loc == 'page' && ($prefs['feature_siteloc'] == 'page' || ($prefs['feature_page_title'] == 'y' && $info) ) ) {
            return _breadcrumb_buildTrail($crumbs);
        } else if (($loc == 'site' || $loc == 'location') && $prefs['feature_siteloc'] == 'y') {
            return _breadcrumb_buildTrail($crumbs);
        } else if ($loc != 'page' && $loc != 'site' && $loc != 'location' && $loc != 'admin') {
            return _breadcrumb_buildTrail($crumbs);
        }
    } else if ($loc == "admin" && $prefs['feature_breadcrumbs'] == 'y') {
        return _breadcrumb_buildTrail($crumbs);
    }<commit_msg>[FIX] breadcrumbs: Obey prefs as breadcrumbs in breadcrumb_buildHeadTitle() are used (in admin for instance) even when the pref is off. Stops the browser title repeating the site name.<commit_after><?php
// (c) Copyright 2002-2010 by authors of the Tiki Wiki/CMS/Groupware Project
// 
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

//this script may only be included - so its better to die if called directly.
if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) {
  header("location: index.php");
  exit;
}

include_once("tikihelplib.php");

class Breadcrumb
{
	var $title;
	var $description;
	var $url;
	var $helpUrl;
	var $helpDescription;

	function Breadcrumb($title, $desc='', $url='', $helpurl='', $helpdesc='') {
                if ($title == '') {
		    $this->title = 'Home';
		} else {
		    $this->title = $title;
		}
		$this->description = $desc;
		$this->url = $url;
		$this->helpUrl = $helpurl;
		$this->helpDescription = $helpdesc;
        }
/* end of class */
}

/* static */
function breadcrumb_buildHeadTitle($crumbs) {
	global $prefs;
	if ($prefs['feature_breadcrumbs'] === 'y') {
	    if( _is_assoc($crumbs) ) {
	        return false;
	    }
	    if( is_array($crumbs) ) {
	        $ret = array();
	        foreach($crumbs as $crumb) {
	            $ret[] = breadcrumb_buildHeadTitle($crumb);
	        }
	        return implode(" : ", $ret);
		} elseif ($prefs['site_title_breadcrumb'] == 'desc') {
			return $crumbs->description;
	    } else {
	        return htmlspecialchars($crumbs->title);
	    }
	} else {
	    if( is_array($crumbs) ) {
			return $crumbs[count($crumbs) - 1]->title;
	    } else {
	    	return $crumbs->title;
	    }
	}
}

/**
 *  @param crumbs array of breadcrumb instances
 *  @param loc where the description will be used: {site|page} site header or page header
 */
/* static */
function breadcrumb_buildTrail($crumbs, $loc) {
    global $prefs, $info;
    if($prefs['feature_breadcrumbs'] == 'y') {
        if ($loc == 'page' && ($prefs['feature_siteloc'] == 'page' || ($prefs['feature_page_title'] == 'y' && $info) ) ) {
            return _breadcrumb_buildTrail($crumbs);
        } else if (($loc == 'site' || $loc == 'location') && $prefs['feature_siteloc'] == 'y') {
            return _breadcrumb_buildTrail($crumbs);
        } else if ($loc != 'page' && $loc != 'site' && $loc != 'location' && $loc != 'admin') {
            return _breadcrumb_buildTrail($crumbs);
        }
    } else if ($loc == "admin" && $prefs['feature_breadcrumbs'] == 'y') {
        return _breadcrumb_buildTrail($crumbs);
    }
{'fraction_non_alphanumeric': 0.16968011126564672, 'fraction_numerical': 0.00337770713292271, 'mean_word_length': 3.089358245329001, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2719256', 'n_tokens_mistral': 1742, 'n_tokens_neox': 1699, 'n_words': 423}