PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.8.1
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.8.1
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
fluent-community / vendor / wpfluent / framework / src / WPFluent / Support / Util.php

Util.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.8.1, at vendor/wpfluent/framework/src/WPFluent/Support/Util.php

71 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\Framework\Support;
4
5 use RuntimeException;
6
7 class Util
8 {
9 /**
10 * Returns a comma-separated string or array of functions that
11 * have been called to get to the current point in code.
12 *
13 * @param string $ignoreClass
14 * @param integer $skipFrames
15 * @param boolean $pretty
16 * @return string|array
17 * @see https://developer.wordpress.org/reference/functions/wp_debug_backtrace_summary/
18 */
19 public static function debugBacktraceSummary(
20 $ignoreClass = null,
21 $skipFrames = 0,
22 $pretty = true
23 ) {
24 return wp_debug_backtrace_summary(
25 $ignoreClass, $skipFrames, $pretty
26 );
27 }
28
29 /**
30 * @param string|array $value
31 * @return mixed
32 * @see https://developer.wordpress.org/reference/functions/wp_slash
33 */
34 public static function addslashes($value)
35 {
36 return wp_slash($value);
37 }
38
39 /**
40 * Convert an absolute file path to URL.
41 *
42 * @param string $filePath
43 * @return string
44 */
45 public static function pathToUrl($filePath = '', $checkFile = false)
46 {
47 if ($checkFile && !file_exists($filePath)) {
48 throw new RuntimeException("File does not exist: {$filePath}");
49 }
50
51 $url = str_replace(
52 wp_normalize_path(untrailingslashit(ABSPATH)),
53 site_url(),
54 wp_normalize_path($filePath)
55 );
56
57 return esc_url_raw($url);
58 }
59
60 /**
61 * Get the user locale.
62 *
63 * @param int|null $userId
64 * @return \FluentCommunity\Framework\Support\Locale
65 */
66 public static function getLocale($userId = null)
67 {
68 return Locale::init($userId);
69 }
70 }
71