Kann überschrieben werden um bestimmte Kategorien auszublenden, zB ProSalzburg die Root-Kategorie
424416
public function getTreePathRows()
    {
        $parts = array($this);
        $upperRow = $this;
        while (!is_null($upperRow = $upperRow->getParentNode())) {
            $parts[] = $upperRow;
        }
        return array_reverse($parts);
    }
1294510
protected void createPainXml() {
        // Hier wird die XML rein geschrieben
        ByteArrayOutputStream o = new ByteArrayOutputStream();

        // Passenden SEPA Generator zur verwendeten pain Version laden
        PainGeneratorIf gen = this.getPainGenerator();

        // Die XML in den baos schreiben, ggf fehler behandeln
        try {
            gen.generate(this.painParams, o, false);
        } catch (HBCI_Exception he) {
            throw he;
        } catch (Exception e) {
            throw new HBCI_Exception("*** the _sepapain segment for this job can not be created", e);
        }

        // Prüfen ob die XML erfolgreich generiert wurde
        if (o.size() == 0)
            throw new HBCI_Exception("*** the _sepapain segment for this job can not be created");

        try {
            String xml = o.toString(CommPinTan.ENCODING);
            log.debug("generated XML:\n" + xml);
            setParam("_sepapain", "B" + xml);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
1265668
public function getCategoryByUri($uri)
    {
        $redirectCategory = null;
        //iteracja po kategoriach
        foreach ((new CmsCategoryQuery())
            ->withType()
            ->andFieldStatus()->equals(\Cms\Orm\CmsCategoryRecord::STATUS_ACTIVE)
            ->andFieldActive()->equals(true)
            //data początku publikacji większa niż dziś
            ->andQuery((new CmsCategoryQuery())
                ->whereDateStart()->equals(null)
                ->orFieldDateStart()->lessOrEquals(date('Y-m-d H:i:s'))
            )
            //data końca publikacji mniejsza niż dziś
            ->andQuery((new CmsCategoryQuery())
                ->whereDateEnd()->equals(null)
                ->orFieldDateEnd()->greaterOrEquals(date('Y-m-d H:i:s'))
            )
            ->andQuery((new CmsCategoryQuery())->searchByUri($uri))
            ->find() as $category) {
            //kategoria jest przekierowaniem
            if ($category->redirectUri) {
                //używane jest pierwsze znalezione przekierowanie
                $redirectCategory = $redirectCategory ? $redirectCategory : $category;
                continue;
            }
            //zwrot treści, lub mvc (priorytet)
            return $category;
        }
        //zwrot przekierowania
        return $redirectCategory;
    }
880210
@SuppressWarnings("unchecked")
    public synchronized void themenLaden() {
        Duration.counterStart(THEME_SEARCH_TEXT);
        LinkedHashSet<String> senderSet = new LinkedHashSet<>(21);
        // der erste Sender ist ""
        senderSet.add("");

        for (DatenFilm film : this) {
            senderSet.add(film.arr[DatenFilm.FILM_SENDER]);
        }
        sender = senderSet.toArray(new String[senderSet.size()]);
        senderSet.clear();

        //für den Sender "" sind alle Themen im themenPerSender[0]
        final int senderLength = sender.length;
        themenPerSender = new String[senderLength][];
        TreeSet<String>[] tree = (TreeSet<String>[]) new TreeSet<?>[senderLength];
        HashSet<String>[] hashSet = (HashSet<String>[]) new HashSet<?>[senderLength];
        for (int i = 0; i < tree.length; ++i) {
            tree[i] = new TreeSet<>(de.mediathekview.mlib.tool.GermanStringSorter.getInstance());
            tree[i].add("");
            hashSet[i] = new HashSet<>();
        }

        //alle Themen
        String filmThema, filmSender;
        for (DatenFilm film : this) {
            filmSender = film.arr[DatenFilm.FILM_SENDER];
            filmThema = film.arr[DatenFilm.FILM_THEMA];
            //hinzufügen
            if (!hashSet[0].contains(filmThema)) {
                hashSet[0].add(filmThema);
                tree[0].add(filmThema);
            }
            for (int i = 1; i < senderLength; ++i) {
                if (filmSender.equals(sender[i])) {
                    if (!hashSet[i].contains(filmThema)) {
                        hashSet[i].add(filmThema);
                        tree[i].add(filmThema);
                    }
                }
            }
        }
        for (int i = 0; i < themenPerSender.length; ++i) {
            themenPerSender[i] = tree[i].toArray(new String[tree[i].size()]);
            tree[i].clear();
            hashSet[i].clear();
        }
        Duration.counterStop(THEME_SEARCH_TEXT);
    }
24120
public function addAction()
    {
        //wyszukiwanie kategorii
        if (null === $cat = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->id)) {
            return;
        }
        //zakładka sekcje
        $widgetForm = (new \CmsAdmin\Form\CategoryAddWidget($cat));
        //zapisany form
        if ($widgetForm->isSaved()) {
            $this->getResponse()->redirect('cmsAdmin', 'categoryWidgetRelation', 'config', ['categoryId' => $this->id, 'widgetId' => $widgetForm->getElement('cmsWidgetId')->getValue()]);
        }
        //form do widoku
        $this->view->widgetForm = $widgetForm;
    }
1282353
public static function getInstance(Kwf_Component_Data $subroot)
    {
        while ($subroot) {
            if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
                break;
            }
            $subroot = $subroot->parent;
        }
        if (!$subroot) $subroot = Kwf_Component_Data_Root::getInstance();

        static $instance = array();
        if (!isset($instance[$subroot->componentId])) {
            $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
            $analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
            //$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
            //$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
            Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
            Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
            Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
            $path = 'cache/fulltext';
            $path .= '/'.$subroot->componentId;
            try {
                $instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
            } catch (Zend_Search_Lucene_Exception $e) {
                $instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
            }
        }
        return $instance[$subroot->componentId];
    }
1087601
def find_germanet_xml_files(xml_path):
    '''
    
    '''
    xml_files = sorted(glob.glob(os.path.join(xml_path, '*.xml')))

    # sort out the lexical files
    lex_files = [xml_file for xml_file in xml_files if
                 re.match(r'(adj|nomen|verben)\.',
                          os.path.basename(xml_file).lower())]
    xml_files = sorted(set(xml_files) - set(lex_files))

    if not lex_files:
        print('ERROR: cannot find lexical information files')

    # sort out the GermaNet relations file
    gn_rels_file = [xml_file for xml_file in xml_files if
                    os.path.basename(xml_file).lower() == 'gn_relations.xml']
    xml_files = sorted(set(xml_files) - set(gn_rels_file))

    if not gn_rels_file:
        print('ERROR: cannot find relations file gn_relations.xml')
        gn_rels_file = None
    else:
        if 1 < len(gn_rels_file):
            print ('WARNING: more than one relations file gn_relations.xml, '
                   'taking first match')
        gn_rels_file = gn_rels_file[0]

    # sort out the wiktionary paraphrase files
    wiktionary_files = [xml_file for xml_file in xml_files if
                        re.match(r'wiktionaryparaphrases-',
                                 os.path.basename(xml_file).lower())]
    xml_files = sorted(set(xml_files) - set(wiktionary_files))

    if not wiktionary_files:
        print('WARNING: cannot find wiktionary paraphrase files')

    # sort out the interlingual index file
    ili_files = [xml_file for xml_file in xml_files if
                os.path.basename(xml_file).lower().startswith(
            'interlingualindex')]
    xml_files = sorted(set(xml_files) - set(ili_files))

    if not ili_files:
        print('WARNING: cannot find interlingual index file')

    if xml_files:
        print('WARNING: unrecognised xml files:', xml_files)

    return lex_files, gn_rels_file, wiktionary_files, ili_files
1062220
protected function setStatViewUpdate()
	{
	    if ($this->bannerCheckBot() === true)
	    {
	        return; //Bot gefunden, wird nicht gezaehlt
	    }
	    if ($this->checkUserAgent() === true)
	    {
	        return ; //User Agent Filterung
	    }
	    
	    // Blocker
	    $lastBanner = array_pop($this->arrBannerData);
	    $BannerID = $lastBanner['banner_id'];
	    if ($BannerID==0)
	    { // kein Banner, nichts zu tun
	        return;
	    }
	    
	    if ( $this->getStatViewUpdateBlockerId($BannerID) === true )
	    {
	        // Eintrag innerhalb der Blockzeit
	        return; // blocken, nicht zählen, raus hier
	    }
	    else
	    {
	        // nichts geblockt, also blocken fürs den nächsten Aufrufs
	        $this->setStatViewUpdateBlockerId($BannerID);
	    }
	    
	    //Zählung, Insert
	    $arrSet = array
	    (
            'id' => $BannerID,
            'tstamp' => time(),
            'banner_views' => 1
	    );
	    $objInsert = \Database::getInstance()->prepare("INSERT IGNORE INTO tl_banner_stat %s")
                                             ->set($arrSet)
                                             ->executeUncached();
	    if ($objInsert->insertId == 0)
	    {
	        //Zählung, Update
	        \Database::getInstance()->prepare("UPDATE 
                                                    `tl_banner_stat` 
                                               SET 
                                                    `tstamp`=?
                                                  , `banner_views` = `banner_views`+1 
                                               WHERE 
                                                    `id`=?")
                                    ->executeUncached(time(), $BannerID);
	    }
	    
	}
429714
def list_kadastrale_afdelingen(self):
        '''
        
        '''

        def creator():
            gemeentes = self.list_gemeenten()
            res = []
            for g in gemeentes:
                res += self.list_kadastrale_afdelingen_by_gemeente(g)
            return res

        if self.caches['permanent'].is_configured:
            key = 'list_afdelingen_rest'
            afdelingen = self.caches['permanent'].get_or_create(key, creator)
        else:
            afdelingen = creator()
        return afdelingen
387242
public Konto getOrderAccount() {
        // Checken, ob wir das Konto unter "My.[number/iban]" haben
        String prefix = this.getName() + ".My.";
        String number = this.getLowlevelParam(prefix + "number");
        String iban = this.getLowlevelParam(prefix + "iban");
        if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0)) {
            // OK, vielleicht unter "KTV.[number/iban]"?
            prefix = this.getName() + ".KTV.";
            number = this.getLowlevelParam(prefix + "number");
            iban = this.getLowlevelParam(prefix + "iban");

            if ((number == null || number.length() == 0) && (iban == null || iban.length() == 0))
                return null; // definitiv kein Konto vorhanden
        }
        Konto k = new Konto();
        k.number = number;
        k.iban = iban;
        k.bic = this.getLowlevelParam(prefix + "bic");
        k.subnumber = this.getLowlevelParam(prefix + "subnumber");
        k.blz = this.getLowlevelParam(prefix + "KIK.blz");
        k.country = this.getLowlevelParam(prefix + "KIK.country");
        return k;
    }
1374686
protected function setFirstViewBlockerId($banner_categorie=0)
	{
	    if ($banner_categorie==0) { return; }// keine Banner Kategorie, nichts zu tun
	     
	    $this->statusFirstViewBlocker = true;
	    $this->setSession('FirstViewBlocker'.$this->module_id, array( $banner_categorie => time() ));
	    return ;
	}
704423
public function getDirectories(Array $ignores = NULL, $subdirs = TRUE) {
    /* wir starten eine Breitensuche (BFS) auf dem Verzeichnis */
    
    $dirs = array(); // Verzeichnisse die schon besucht wurden
    $queue = array($this);

    while (count($queue) > 0) {
      $elem = array_pop($queue);

      /* dies machen wir deshalb, da wenn extension gesetzt ist, keine verzeichnisse gesetzt werden */
      foreach($elem->getContents(NULL,$ignores) as $item) {
        if ($item instanceof Dir && !array_key_exists((string) $item, $dirs)) { // ist das verzeichnis schon besucht worden?

          if ($subdirs) // wenn nicht wird hier nichts der queue hinzugefügt und wir bearbeiten kein unterverzeichnis
            array_unshift($queue,$item);

          /* besucht markieren */
          $dirs[(string) $item] = $item;
        }
      }
    }
    
    return $dirs;
  }
1065727
protected function getStatViewUpdateBlockerId($banner_id=0)
	{
	    $this->getSession('StatViewUpdateBlocker'.$this->module_id);
	    if ( count($this->_session) )
	    {
	        reset($this->_session);
	        foreach ($this->_session as $key => $val)
	        {
	            if ( $key == $banner_id && 
	                 $this->removeStatViewUpdateBlockerId($key, $val) === true )
	            {
	                // Key ist noch gültig und es muss daher geblockt werden
	                //DEBUG log_message('getStatViewUpdateBlockerId Banner ID:'.$key,'Banner.log');
	                return true;
	            }
	        }
	    }
	    return false;
	}
258342
function(){
		var lines = this.fstr.split("\n");
		var firstline = lines.shift();
		delete this.fstr;
		
		/* ヘッダからパズルの種類・ファイルの種類を判定する */
		if(firstline.match(/^pzprv3/)){
			this.type = FILE_PZPR;
			if(firstline.match(/pzprv3\.(\d+)/)){ this.filever = +RegExp.$1;}
			this.pid = lines.shift();
			this.qdata = lines.join("\n");
		}
		else if(firstline.match(/^\<\?xml/)){ // jshint ignore:line
			this.type = FILE_PBOX_XML;
			lines.unshift(firstline);
			this.qdata = lines.join("\n");
			if(!!DOMParser){
				this.body = (new DOMParser()).parseFromString(this.qdata, 'text/xml');
				this.pid = this.body.querySelector('puzzle').getAttribute('type');
			}
			else{ this.pid = '';}
		}
		else if(firstline.match(/^\d+$/)){
			this.type = FILE_PBOX;
			lines.unshift(firstline);
			this.qdata = lines.join("\n");
		}
		else{
			this.pid = '';
		}
		this.pid = pzpr.variety.toPID(this.pid);
		
		return (!!this.pid);
	}
954383
protected void addPredicates(CriteriaBuilder criteriaBuilder, Root<T> root, CriteriaQuery<?> criteriaQuery, List<Predicate> predicates) {
		
		// Si la liste de predicats est vide
		if(predicates == null || predicates.size() == 0) return;
		
		// Liste de predicats JPA 2
		List<javax.persistence.criteria.Predicate> jpaPredicates = new ArrayList<javax.persistence.criteria.Predicate>();
		
		// Parcours de la liste
		for (Predicate predicate : predicates) {
			
			// Ajout du critere JPA
			jpaPredicates.add(predicate.generateJPAPredicate(criteriaBuilder, root));
		}
		
		// Si la liste des prdicats JPA est de taille 1
		if(jpaPredicates.size() == 1) criteriaQuery.where(jpaPredicates.get(0));
		
		// Sinon
		else criteriaQuery.where(criteriaBuilder.and(jpaPredicates.toArray(new javax.persistence.criteria.Predicate[0])));
	}
725307
private static String mapFrenchTagSetToKaf(final String postag) {
    if (postag.startsWith("ADV")) {
      return "A"; // adverb
    } else if (postag.equalsIgnoreCase("CC") || postag.equalsIgnoreCase("CS")) {
      return "C"; // conjunction
    } else if (postag.startsWith("D") || postag.startsWith("I")) {
      return "D"; // det predeterminer
    } else if (postag.startsWith("ADJ")) {
      return "G"; // adjective
    } else if (postag.startsWith("NC")) {
      return "N"; // common noun
    } else if (postag.startsWith("NPP")) {
      return "R"; // proper noun
    } else if (postag.startsWith("PRO") || postag.startsWith("CL")) {
      return "Q"; // pronoun
    } else if (postag.equalsIgnoreCase("P") || postag.equalsIgnoreCase("P+D")
        || postag.equalsIgnoreCase("P+PRO")) {
      return "P"; // preposition
    } else if (postag.startsWith("V")) {
      return "V"; // verb
    } else {
      return "O"; // other
    }
  }
1000261
private static byte[] persist(String description, Directory rootDir, Blob icon) {
		ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
		DataOutputStream dataOutputStream = new DataOutputStream(arrayOutputStream);

		try {
			// Immer erster Stelle die aktuelle Version schreiben
			dataOutputStream.writeByte(CURRENT_BINARY_VERSION);

			// Die Reihenfolge der Felder darf sich aus Gründen der
			// Kompatibilität niemals ändern. Neue Felder können hinzugefügt
			// werden. Dann ist die Version hochzusetzten.
			dataOutputStream.writeUTF(rootDir.id());
			dataOutputStream.writeUTF(description);
			dataOutputStream.writeUTF(icon != null ? icon.id() : "");
		} catch (IOException e) {
			throw new RuntimeException(e);
		}

		return arrayOutputStream.toByteArray();
	}