source: gs2-extensions/ngramj/src/wiki/wiki2xml/php/global_functions.php@ 25141

Last change on this file since 25141 was 25141, checked in by papitha, 12 years ago

NGRAMJ PERL MODULE ADDED /MAORI LANGUAGE GUESSING WORKING WELL!!

File size: 1.1 KB
Line 
1<?php
2
3# Add authors to global list
4function add_authors ( $authors ) {
5 global $wiki2xml_authors ;
6 foreach ( $authors AS $author ) {
7 if ( !in_array ( $author , $wiki2xml_authors ) ) {
8 $wiki2xml_authors[] = $author ;
9 }
10 }
11}
12
13function add_author ( $author ) {
14 add_authors ( array ( $author ) ) ;
15 }
16
17
18# For text file structure creation and browsing
19function get_file_location_global ( $basedir , $ns , $title , $make_dirs = false ) {
20 $title = urlencode ( $title ) ;
21 $title = str_replace ( ":" , "_" , $title ) ;
22 $m = md5 ( $title ) ;
23 $ret = "" ;
24 $ret->file = $title ;
25 if ( $ret->file == "Con" ) $ret->file = "_Con" ; # Windows can't create files named "con.txt" (!), workaround
26 $ret->dir = $basedir . "/" . $ns ;
27 if ( $make_dirs ) @mkdir ( $ret->dir ) ;
28 $ret->dir .= "/" . substr ( $m , 0 , 1 ) ;
29 if ( $make_dirs ) @mkdir ( $ret->dir ) ;
30 $ret->dir .= "/" . substr ( $m , 1 , 2 ) ;
31 if ( $make_dirs ) @mkdir ( $ret->dir ) ;
32 $ret->fullname = $ret->dir . "/" . $ret->file ;
33 return $ret ;
34}
35
36
37function xml_articles_header() {
38 global $xmlg ;
39# if ( !isset ( $xmlg['xml_articles_header'] ) ) return "" ;
40 return $xmlg['xml_articles_header'] ;
41}
42
43?>
Note: See TracBrowser for help on using the repository browser.