-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathredefinedFunctions.php
More file actions
25 lines (25 loc) · 924 Bytes
/
redefinedFunctions.php
File metadata and controls
25 lines (25 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
if (!function_exists('plugin_dir_url')) {
function plugin_dir_url($file = __FILE__) {
$plugin_dir_url = get_option('siteurl') . '/' . PLUGINDIR . '/' .
basename(dirname($file)) . '/';
return $plugin_dir_url ;
}
}
if (!function_exists('plugins_url')) {
function plugins_url($path = '' , $plugin = '') {
$plugin_base = get_option('siteurl') . '/' . PLUGINDIR ;
if (empty($path) && empty($plugin)) return $plugin_base ;
if (empty($plugin)) return $plugin_base . '/' . $path ;
else return $plugin_base . '/' . $plugin . '/' . basename($path) ;
}
}
if (!function_exists('plugin_basename')) {
function plugin_basename($file = __FILE__) {
$pluginPath = realpath(plugin_dir_path(dirname($file))) ;
$filePath = realpath($file) ;
$diffPos = strspn($pluginPath ^ $filePath, "\0"); // XOR and look for \0
$baseName = substr($file, $diffPos+1) ;
return $baseName ;
}
}