src/Cuztom.php
public function getCuztomUrl($path = __FILE__, $url = [])
    {
        // Retun URL if defined
        if (defined('CUZTOM_URL')) {
            return CUZTOM_URL;
        }

        // Base vars
        $path = dirname($path);
        $path = str_replace('\\', '/', $path);
        $expath = explode('/', $path);
        $current = $expath[count($expath) - 1];

        // Push to path array
        array_push($url, $current);

        // Check for current
        if (preg_match('/content|app/', $current)) {
            $path = '';
            $directories = array_reverse($url);

            foreach ($directories as $dir) {
                if (! preg_match('/content|app/', $dir)) {
                    $path = $path.'/'.$dir;
                }
            }

            return apply_filters('cuztom_url', WP_CONTENT_URL.$path);
        } else {
            return $this->getCuztomUrl($path, $url);
        }
    }
public function getCuztomUrl($path = __FILE__, $url = [])
    {
        // Retun URL if defined
        if (defined('CUZTOM_URL')) {
            return CUZTOM_URL;
        }

        // Base vars
        $path = dirname($path);
        $path = str_replace('\\', '/', $path);
        $expath = explode('/', $path);
        $current = $expath[count($expath) - 1];

        // Push to path array
        array_push($url, $current);

        // Check for current
        if (preg_match('/content|app/', $current)) {
            $path = '';
            $directories = array_reverse($url);

            foreach ($directories as $dir) {
                if (! preg_match('/content|app/', $dir)) {
                    $path = $path.'/'.$dir;
                }
            }

            return apply_filters('cuztom_url', WP_CONTENT_URL.$path);
        } else {
            return $this->getCuztomUrl($path, $url);
        }
    }
public function getCuztomUrl ( $ path = __FILE__ , $ url = [ ] ) { // Retun URL if defined if ( defined ( 'CUZTOM_URL' ) ) { return CUZTOM_URL ; } // Base vars $ path = dirname ( $ path ) ; $ path = str_replace ( '\\' , '/' , $ path ) ; $ expath = explode ( '/' , $ path ) ; $ current = $ expath [ count ( $ expath ) - 1 ] ; // Push to path array array_push ( $ url , $ current ) ; // Check for current if ( preg_match ( '/content|app/' , $ current ) ) { $ path = '' ; $ directories = array_reverse ( $ url ) ; foreach ( $ directories as $ dir ) { if ( ! preg_match ( '/content|app/' , $ dir ) ) { $ path = $ path . '/' . $ dir ; } } return apply_filters ( 'cuztom_url' , WP_CONTENT_URL . $ path ) ; } else { return $ this -> getCuztomUrl ( $ path , $ url ) ; } }
Recursive method to determine the path to the Cuztom folder.

@param  string $path
@param  array  $url
@return string
Recursive method to determine the path to the Cuztom folder .