XOOPS  2.6.0
functions.php
Go to the documentation of this file.
1 <?php
25 function xoops_getHandler($name, $optional = false)
26 {
28  $xoops->deprecated('xoops_getHandler(\'' . $name . '\') is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
29  $method = 'getHandler' . ucfirst(strtolower(trim($name)));
30  return $xoops->$method($optional);
31 }
32 
40 function xoops_getModuleHandler($name = null, $module_dir = null, $optional = false)
41 {
42  $xoops = Xoops::getInstance();
43  $xoops->deprecated(__FUNCTION__ . ' is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
44  return $xoops->getModuleHandler($name, $module_dir, $optional);
45 }
46 
53 function xoops_load($name, $type = 'core')
54 {
55  $xoops = Xoops::getInstance();
56  $xoops->deprecated(__FUNCTION__ . ' is deprecated. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
57  return XoopsLoad::load($name, $type);
58 }
59 
69 function xoops_loadLanguage($name, $domain = '', $language = null)
70 {
71  $xoops = Xoops::getInstance();
72  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
73  return $xoops->loadLanguage($name, $domain, $language);
74 }
75 
80 function xoops_getActiveModules()
81 {
82  $xoops = Xoops::getInstance();
83  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
84  return $xoops->getActiveModules();
85 }
86 
91 function xoops_setActiveModules()
92 {
93  $xoops = Xoops::getInstance();
94  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
95  return $xoops->setActiveModules();
96 }
97 
103 function xoops_isActiveModule($dirname)
104 {
105  $xoops = Xoops::getInstance();
106  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
107  return $xoops->isActiveModule($dirname);
108 }
109 
115 function xoops_header($closehead = true)
116 {
117  $xoops = Xoops::getInstance();
118  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
119  $xoops->simpleHeader($closehead);
120 }
121 
126 function xoops_footer()
127 {
128  $xoops = Xoops::getInstance();
129  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
130  $xoops->simpleFooter();
131 }
132 
139 function xoops_error($msg, $title = '')
140 {
141  $xoops = Xoops::getInstance();
142  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
143  echo $xoops->alert('error', $msg, $title);
144 }
145 
152 function xoops_result($msg, $title = '')
153 {
154  $xoops = Xoops::getInstance();
155  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
156  echo $xoops->alert('info', $msg, $title);
157 }
158 
168 function xoops_confirm($hiddens, $action, $msg, $submit = '', $addtoken = true)
169 {
170  $xoops = Xoops::getInstance();
171  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
172  echo $xoops->confirm($hiddens, $action, $msg, $submit, $addtoken);
173 }
174 
181 function xoops_getUserTimestamp($time, $timeoffset = '')
182 {
183  $xoops = Xoops::getInstance();
184  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
185  return $xoops->getUserTimestamp($time, $timeoffset);
186 }
187 
195 function formatTimestamp($time, $format = 'l', $timeoffset = '')
196 {
197  $xoops = Xoops::getInstance();
198  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
199  return XoopsLocale::formatTimestamp($time, $format, $timeoffset);
200 }
201 
208 function userTimeToServerTime($timestamp, $userTZ = null)
209 {
210  $xoops = Xoops::getInstance();
211  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
212  return $xoops->userTimeToServerTime($timestamp, $userTZ);
213 }
214 
219 function xoops_makepass()
220 {
221  $xoops = Xoops::getInstance();
222  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
223  return $xoops->makePass();
224 }
225 
232 function checkEmail($email, $antispam = false)
233 {
234  $xoops = Xoops::getInstance();
235  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
236  return $xoops->checkEmail($email, $antispam);
237 }
238 
244 function formatURL($url)
245 {
246  $xoops = Xoops::getInstance();
247  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
248  return $xoops->formatURL($url);
249 }
250 
255 function xoops_getbanner()
256 {
257  $xoops = Xoops::getInstance();
258  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
259  return $xoops->getBanner();
260 }
261 
271 function redirect_header($url, $time = 3, $message = '', $addredirect = true, $allowExternalLink = false)
272 {
273  $xoops = Xoops::getInstance();
274  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
275  $xoops->redirect($url, $time, $message, $addredirect, $allowExternalLink);
276 }
277 
283 function xoops_getenv($key)
284 {
285  $xoops = Xoops::getInstance();
286  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
287  return $xoops->getEnv($key);
288 }
289 
295 function xoops_getcss($theme = '')
296 {
297  $xoops = Xoops::getInstance();
298  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
299  return $xoops->getCss($theme);
300 }
301 
306 function xoops_getMailer()
307 {
308  $xoops = Xoops::getInstance();
309  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
310  return $xoops->getMailer();
311 }
312 
319 function xoops_getrank($rank_id = 0, $posts = 0)
320 {
321  $xoops = Xoops::getInstance();
322  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
323  return $xoops->getRank($rank_id, $posts);
324 }
325 
334 function xoops_substr($str, $start, $length, $trimmarker = '...')
335 {
336  $xoops = Xoops::getInstance();
337  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
338  return XoopsLocale::substr($str, $start, $length, $trimmarker);
339 }
340 
346 function xoops_notification_deletebymodule($module_id)
347 {
348  $xoops = Xoops::getInstance();
349  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. Use Notifications module instead.');
350 }
351 
357 function xoops_notification_deletebyuser($user_id)
358 {
359  $xoops = Xoops::getInstance();
360  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. Use Notifications module instead.');
361 }
362 
370 function xoops_notification_deletebyitem($module_id, $category, $item_id)
371 {
372  $xoops = Xoops::getInstance();
373  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. Use Notifications module instead.');
374 }
375 
382 function xoops_comment_count($module_id, $item_id = null)
383 {
384  $xoops = Xoops::getInstance();
385  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. Use comments module instead.');
386 }
387 
394 function xoops_comment_delete($module_id, $item_id)
395 {
396  $xoops = Xoops::getInstance();
397  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. Use comments module instead.');
398 }
399 
407 function xoops_groupperm_deletebymoditem($module_id, $perm_name, $item_id = null)
408 {
409  $xoops = Xoops::getInstance();
410  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
411  return $xoops->getHandlerGroupperm()->deleteByModule($module_id, $perm_name, $item_id);
412 }
413 
419 function xoops_utf8_encode(&$text)
420 {
421  $xoops = Xoops::getInstance();
422  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
423  XoopsLocale::utf8_encode($text);
424 }
425 
431 function xoops_convert_encoding(&$text)
432 {
433  $xoops = Xoops::getInstance();
434  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
435  XoopsLocale::utf8_encode($text);
436 }
437 
443 function xoops_trim($text)
444 {
445  $xoops = Xoops::getInstance();
446  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
447  return XoopsLocale::trim($text);
448 }
449 
455 function xoops_getOption($option)
456 {
457  $xoops = Xoops::getInstance();
458  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
459  return $xoops->getOption($option);
460 }
461 
468 function xoops_getConfigOption($option, $type = 'XOOPS_CONF')
469 {
470  $xoops = Xoops::getInstance();
471  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
472  return $xoops->getConfig($option);
473 }
474 
481 function xoops_setConfigOption($option, $new = null)
482 {
483  $xoops = Xoops::getInstance();
484  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
485  $xoops->setConfig($option, $new);
486 }
487 
494 function xoops_getModuleOption($option, $dirname = '')
495 {
496  $xoops = Xoops::getInstance();
497  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
498  return $xoops->getModuleConfig($option, $dirname);
499 }
500 
507 function xoops_getBaseDomain($url, $debug = 0)
508 {
509  $xoops = Xoops::getInstance();
510  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
511  return $xoops->getBaseDomain($url);
512 }
513 
519 function xoops_getUrlDomain($url)
520 {
521  $xoops = Xoops::getInstance();
522  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
523  return $xoops->getBaseDomain($url, true);
524 }
525 
533 function xoops_template_touch($tpl_id, $clear_old = true)
534 {
535  $xoops = Xoops::getInstance();
536  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
537  return $xoops->templateTouch($tpl_id);
538 }
539 
546 function xoops_template_clear_module_cache($mid)
547 {
548  $xoops = Xoops::getInstance();
549  $xoops->deprecated(__FUNCTION__ . ' is deprecated since XOOPS 2.6.0. See how to replace it in file ' . __FILE__ . ' line ' . __LINE__);
550  $xoops->templateClearModuleCache($mid);
551 }
552 
553 
554 // general php version compatibility functions
555 
556 if (!function_exists('http_response_code')) {
567  function http_response_code($newcode = null)
568  {
569  static $code = 200;
570  if ($newcode !== null) {
571  header('X-PHP-Response-Code: '.$newcode, true, $newcode);
572  if (!headers_sent()) {
573  $code = $newcode;
574  }
575  }
576  return $code;
577  }
578 }
579 
580 // ENT_SUBSTITUTE flag for htmlspecialchars() added in PHP 5.4
581 if (!defined('ENT_SUBSTITUTE')) {
582  define('ENT_SUBSTITUTE', 0);
583 }
584 
601 function xhtmlspecialchars($string, $dummy_flags = 0, $dummy_encoding = '', $dummy_double_encode = true)
602 {
603  return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
604 }
static getInstance()
Definition: Xoops.php:160
const XOOPS_CONF
Definition: configitem.php:28
xoops_getHandler($name, $optional=false)
Definition: functions.php:25
$xoops
Definition: admin.php:25