1: <?php
  2: /*
  3:  You may not change or alter any portion of this comment or credits
  4:  of supporting developers from this source code or any supporting source code
  5:  which is considered copyrighted (c) material of the original comment or credit authors.
  6: 
  7:  This program is distributed in the hope that it will be useful,
  8:  but WITHOUT ANY WARRANTY; without even the implied warranty of
  9:  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 10: */
 11: 
 12: /**
 13:  * XOOPS listing utilities
 14:  *
 15:  * @copyright   XOOPS Project (http://xoops.org)
 16:  * @license     GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 17:  * @package     class
 18:  * @since       2.0.0
 19:  * @version     $Id$
 20:  */
 21: 
 22: /**
 23:  * XoopsLists
 24:  *
 25:  * @author     John Neill <catzwolf@xoops.org>
 26:  * @copyright  2011-2015 copyright (c) XOOPS.org
 27:  * @package    Xoops\Core
 28:  * @subpackage Lists
 29:  * @access public
 30:  */
 31: class XoopsLists
 32: {
 33:     /**
 34:      * get list of timezones
 35:      *
 36:      * @return array
 37:      */
 38:     public static function getTimeZoneList()
 39:     {
 40:         return \Xoops\Core\Lists\TimeZone::getList();
 41:     }
 42: 
 43:     /**
 44:      * gets list of themes folder from themes directory
 45:      *
 46:      * @return array
 47:      */
 48:     public static function getThemesList()
 49:     {
 50:         return \Xoops\Core\Lists\Theme::getList();
 51:     }
 52: 
 53:     /**
 54:      * gets a list of module folders from the modules directory
 55:      *
 56:      * @return array
 57:      */
 58:     public static function getModulesList()
 59:     {
 60:         return \Xoops\Core\Lists\Module::getList();
 61:     }
 62: 
 63:     /**
 64:      * gets list of editors
 65:      *
 66:      * @return array
 67:      */
 68:     public static function getEditorList()
 69:     {
 70:         return \Xoops\Core\Lists\Editor::getList();
 71:     }
 72: 
 73:     /**
 74:      * gets list of name of directories inside a directory
 75:      *
 76:      * @param string $path filesystem path
 77:      *
 78:      * @return array
 79:      */
 80:     public static function getDirListAsArray($path)
 81:     {
 82:         $ignored = array('cvs', '_darcs');
 83:         return \Xoops\Core\Lists\Directory::getList($path, $ignored);
 84:     }
 85: 
 86:     /**
 87:      * gets list of all files in a directory
 88:      *
 89:      * @param string $path   filesystem path
 90:      * @param string $prefix prefix added to file names
 91:      *
 92:      * @return array
 93:      */
 94: 
 95:     public static function getFileListAsArray($path, $prefix = '')
 96:     {
 97:         return \Xoops\Core\Lists\File::getList($path, $prefix);
 98:     }
 99: 
100:     /**
101:      * gets list of image file names in a directory
102:      *
103:      * @param string $path   filesystem path
104:      * @param string $prefix prefix added to file names
105:      *
106:      * @return array
107:      */
108:     public static function getImgListAsArray($path, $prefix = '')
109:     {
110:         return \Xoops\Core\Lists\ImageFile::getList($path, $prefix);
111:     }
112: 
113:     /**
114:      * gets list of html file names in a certain directory
115:      *
116:      * @param string $path   filesystem path
117:      * @param string $prefix prefix added to file names
118:      *
119:      * @return array
120:      */
121:     public static function getHtmlListAsArray($path, $prefix = '')
122:     {
123:         return \Xoops\Core\Lists\HtmlFile::getList($path, $prefix);
124:     }
125: 
126:     /**
127:      * gets list of subject icon image file names in a certain directory
128:      * if directory is not specified, default directory will be searched
129:      *
130:      * @param string $subDirectory
131:      *
132:      * @return array
133:      */
134:     public static function getSubjectsList($subDirectory = '')
135:     {
136:         return \Xoops\Core\Lists\SubjectIcon::getList($subDirectory);
137:     }
138: 
139:     /**
140:      * gets list of language folders inside default language directory
141:      *
142:      * @return array
143:      */
144:     public static function getLangList()
145:     {
146:         $lang_list = XoopsLists::getDirListAsArray(\XoopsBaseConfig::get('root-path') . '/language/');
147: 
148:         return $lang_list;
149:     }
150: 
151:     /**
152:      * gets list of locale folders inside default language directory
153:      *
154:      * @param boolean $showInCodeLanguage true to show a code's name in the language the code represents
155:      *
156:      * @return array
157:      */
158:     public static function getLocaleList($showInCodeLanguage = false)
159:     {
160:         return \Xoops\Core\Lists\Locale::getList($showInCodeLanguage);
161:     }
162: 
163:     /**
164:      * XoopsLists::getCountryList()
165:      *
166:      * @return array
167:      */
168:     public static function getCountryList()
169:     {
170:         return \Xoops\Core\Lists\Country::getList();
171:     }
172: 
173:     /**
174:      * Get a list of localized month names
175:      *
176:      * @param string $width The format name; it can be 'wide' (eg 'January'),
177:      *                      'abbreviated' (eg 'Jan') or 'narrow' (eg 'J').
178:      *
179:      * @return string Returns an empty string if $value is empty, the name of the month otherwise.
180:      */
181:     public static function getMonthList($width = 'wide')
182:     {
183:         return \Xoops\Core\Lists\Month::getList($width);
184:     }
185: }
186: