tiki  21.2
About: Tiki Wiki is a Groupware/CMS (Content Management System) solution that has features like Wikis, Forums, Blogs, Articles, Image Gallery, Map Server, Link Directory, Multilingual Support, Bug Tracker, RSS Feeds etc. Latest release 21 with Long Term Support (LTS).
  Fossies Dox: tiki-21.2.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

get_strings.php
Go to the documentation of this file.
1 <?php
5 // (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6 //
7 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
8 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9 // $Id$
10 
37 echo "\nUse of this file is now deprecated. use php console.php translation:getstrings instead.\n";
38 
39 if (php_sapi_name() != 'cli') {
40  require_once('tiki-setup.php');
41  $access->check_permission('tiki_p_admin');
42 }
43 
44 require_once('lib/init/initlib.php');
45 require_once('lib/setup/timer.class.php');
46 
47 $timer = new timer();
48 $timer->start();
49 
50 $options = [];
51 
53 
54 if ($request->hasProperty('lang')) {
55  $options['lang'] = $request->getProperty('lang');
56 }
57 
58 if ($request->hasProperty('outputFiles')) {
59  $options['outputFiles'] = $request->getProperty('outputFiles');
60 }
61 
63  'dump' , 'img', 'lang', 'bin', 'installer/schema',
64  'vendor_bundled', 'vendor', 'vendor_extra', 'vendor_custom',
65  'lib/test', 'temp', 'permissioncheck',
66  'storage', 'tiki_tests', 'doc', 'db','lib/openlayers','tests', 'modules/cache'
67 ];
68 $excludeDirs = array_filter($excludeDirs, 'is_dir'); // only keep in the exclude list if the dir exists
69 
70 // Files are processed after the base directory, so adding a file here allows to scan it even if its directory was excluded.
72  './lang/langmapping.php', './img/flags/flagnames.php'
73 ];
74 
75 // command-line only options
76 if (php_sapi_name() == 'cli') {
77  if ($request->hasProperty('baseDir')) {
78  $options['baseDir'] = $request->getProperty('baseDir');
79 
80  // when a custom base dir is set, default $includeFiles and $excludeDirs are not used
81  $includeFiles = [];
82  $excludeDirs = [];
83  }
84 
85  if ($request->hasProperty('excludeDirs')) {
86  $excludeDirs = explode(',', $request->getProperty('excludeDirs'));
87  }
88 
89  if ($request->hasProperty('includeFiles')) {
90  $includeFiles = explode(',', $request->getProperty('includeFiles'));
91  }
92 
93  if ($request->hasProperty('fileName')) {
94  $options['fileName'] = $request->getProperty('fileName');
95  }
96 }
97 
99 
100 $getStrings->addFileType(new Language_FileType_Php);
101 $getStrings->addFileType(new Language_FileType_Tpl);
102 
103 // skip the following directories
104 $getStrings->collectFiles->setExcludeDirs($excludeDirs);
105 
106 // manually add the following files from skipped directories
107 $getStrings->collectFiles->setIncludeFiles($includeFiles);
108 
109 echo formatOutput("Languages: " . implode(' ', $getStrings->getLanguages()) . "\n");
110 
111 $getStrings->run();
112 
113 echo formatOutput("\nTotal time spent: " . $timer->stop() . " seconds\n");
114 
119 function formatOutput($string)
120 {
121  if (php_sapi_name() == 'cli') {
122  return $string;
123  } else {
124  return nl2br($string);
125  }
126 }
$includeFiles
$includeFiles
Definition: get_strings.php:71
$excludeDirs
if($request->hasProperty('lang')) if($request->hasProperty('outputFiles')) $excludeDirs
Definition: get_strings.php:62
Language_FileType_Php
Definition: Php.php:15
php
Tiki_Request
Definition: Request.php:13
timer
Definition: timer.class.php:9
$access
$access
Definition: include_rating.php:15
$options
$options
Definition: get_strings.php:50
$timer
$timer
Definition: get_strings.php:47
Language_WriteFile_Factory
Definition: Factory.php:15
formatOutput
formatOutput($string)
Definition: get_strings.php:119
Language_FileType_Tpl
Definition: Tpl.php:13
$getStrings
if(php_sapi_name()=='cli') $getStrings
Definition: get_strings.php:98
$request
$request
Definition: get_strings.php:52
Language_GetStrings
Definition: GetStrings.php:14
Language_CollectFiles
Definition: CollectFiles.php:19