Get the path to /src/Assets either of the app or the provided $plugin.

@param bool|string $plugin The name of a plugin or false.
@return string
161559
protected function _getBaseAssetPath($plugin = false)
    {
        if ($plugin !== false) {
            return $this->_getPluginPath($plugin) . 'src' . DS . 'Assets' . DS;
        }

        return ROOT . DS . 'src' . DS . 'Assets' . DS;
    }
441857
public static function registerRedactorPlugin(string $plugin)
    {
        if (isset(self::$_registeredPlugins[$plugin])) {
            return;
        }

        $paths = self::redactorPluginPaths();

        foreach ($paths as $registeredPath) {
            foreach (["{$registeredPath}/{$plugin}", $registeredPath] as $path) {
                if (file_exists("{$path}/{$plugin}.js")) {
                    $view = Craft::$app->getView();
                    $baseUrl = Craft::$app->getAssetManager()->getPublishedUrl($path, true);
                    $view->registerJsFile("{$baseUrl}/{$plugin}.js", [
                        'depends' => RedactorAsset::class
                    ]);
                    // CSS file too?
                    if (file_exists("{$path}/{$plugin}.css")) {
                        $view->registerCssFile("{$baseUrl}/{$plugin}.css");
                    }
                    // Don't do this twice
                    self::$_registeredPlugins[$plugin] = true;
                    return;
                }
            }
        }

        throw new InvalidConfigException('Redactor plugin not found: '.$plugin);
    }
576756
protected function _getFilePath($key) {
		if (substr($key, -5) === '.json') {
			$key = substr($key, 0, -5);
		}
		list($plugin, $key) = pluginSplit($key);
		$key .= '.json';

		if ($plugin) {
			$file = App::pluginPath($plugin) . 'Config' . DS . $key;
		} else {
			$file = $this->_path . $key;
		}

		return $file;
	}
1138900
public function adminPath($filename, $absolute = true)
    {
        $path = "ext/{$this->plugin->getName()}/admin/templates/$filename";
        if ($absolute)
        {
            $path = $this->getFullPath($path);
        }
        return $path;
    }
23765
public static function plugin($plugin)
    {
        $templates = [];

        foreach (App::path('Template', $plugin) as $path) {
            $templates = array_merge($templates, static::iteratePath($path));
        }

        return $templates;
    }
617774
public static function getPluginPath($name = null)
	{
		$path = Config::get()->get('plugin.path');
		if ($name != null) {
			$path = $path . '/' . $name;
		}
		return $path;
	}
1169689
protected static function stripAbsolutePath(array $paths, $plugin = null): array
    {
        foreach (App::path('Template', $plugin) as $templatesPath) {
            array_walk($paths, function (&$path) use ($templatesPath) {
                if (substr($path, 0, strlen($templatesPath)) == $templatesPath) {
                    $path = substr($path, strlen($templatesPath));
                }
            });
        }

        return $paths;
    }
367785
private function get_plugin_slug( $url ) {
		if ( $this->app->utility->starts_with( $url, 'https://wordpress.org/plugins/' ) ) {
			return trim( str_replace( 'https://wordpress.org/plugins/', '', $url ), '/' );
		}

		return false;
	}
512627
public function getPlugin($name)
    {
        foreach (array_keys(get_plugins()) as $file) {
            // Logic taken from WP-CLI.
            if ($file === "{$name}.php" || ($name && $file === $name) || (dirname($file) === $name && $name !== '.')) {
                return $file;
            }
        }

        return '';
    }
1072748
private function build($dest = null, $plugin = null)
    {
        if ($plugin !== null) {
            /** @noinspection PhpIncludeInspection */
            $builds = file_exists($this->pluginManifestOfAssets) ? include $this->pluginManifestOfAssets : [];
            if (!isset($builds[$plugin])) {
                throw new InvalidArgumentException('Plugin "' . $plugin . '" has no assets or is not installed.');
            }
            /** @noinspection PhpIncludeInspection */
            $build = $builds[$plugin];
        }
        else {
            /** @noinspection PhpIncludeInspection */
            $build = require $this->buildFile;
        }

        // get only one asset if specified
        if ($dest !== null) {
            if (!isset($build[$dest])) {
                throw new InvalidArgumentException('Asset "' . $dest . '" is not defined.');
            }
            $build = [$dest => $build[$dest]];
        }

        // make relative path to absolute
        $basePath = base_path();
        foreach ($build as $asset => $sources) {
            foreach ($sources as $i => $source) {
                if (!is_absolute_path($source)) {
                    $build[$asset][$i] = $basePath . DIRECTORY_SEPARATOR . $source;
                }
            }
        }

        return $build;
    }
1242763
protected function _getBasePath($plugin = false)
    {
        if ($plugin !== false) {
            return $this->_getPluginPath($plugin) . 'webroot' . DS;
        }

        return WWW_ROOT;
    }
1007765
protected function getCustomThemeLoader(Plugin $theme)
    {
        $pluginsDir = Manager::getPluginDirectory($theme->getPluginName());
        $themeDir = $pluginsDir . '/templates/';

        if (!file_exists($themeDir)) {
            return false;
        }
        $themeLoader = new Twig_Loader_Filesystem(array($themeDir), PIWIK_DOCUMENT_ROOT.DIRECTORY_SEPARATOR);

        return $themeLoader;
    }
859921
private function getDoneStringForPlugin($plugin, $idSites)
    {
        return Rules::getDoneStringFlagFor(
                    $idSites,
                    $this->params->getSegment(),
                    $this->getPeriodLabel(),
                    $plugin
        );
    }
997367
protected function _paths($plugin = null, $cached = true)
    {
        if ($cached === true) {
            if ($plugin === null && !empty($this->_paths)) {
                return $this->_paths;
            }
            if ($plugin !== null && isset($this->_pathsForPlugin[$plugin])) {
                return $this->_pathsForPlugin[$plugin];
            }
        }
        $templatePaths = App::path(static::NAME_TEMPLATE);
        $pluginPaths = $themePaths = [];
        if (!empty($plugin)) {
            for ($i = 0, $count = count($templatePaths); $i < $count; $i++) {
                $pluginPaths[] = $templatePaths[$i] . 'Plugin' . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR;
            }
            $pluginPaths = array_merge($pluginPaths, App::path(static::NAME_TEMPLATE, $plugin));
        }

        if (!empty($this->theme)) {
            $themePaths = App::path(static::NAME_TEMPLATE, Inflector::camelize($this->theme));

            if ($plugin) {
                for ($i = 0, $count = count($themePaths); $i < $count; $i++) {
                    array_unshift($themePaths, $themePaths[$i] . 'Plugin' . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR);
                }
            }
        }

        $paths = array_merge(
            $themePaths,
            $pluginPaths,
            $templatePaths,
            [dirname(__DIR__) . DIRECTORY_SEPARATOR . static::NAME_TEMPLATE . DIRECTORY_SEPARATOR]
        );

        if ($plugin !== null) {
            return $this->_pathsForPlugin[$plugin] = $paths;
        }

        return $this->_paths = $paths;
    }
583551
public static function pluginUrl($plugin, $action, $params = array(), $useIndex = true)
    {
    	$plugin = ucfirst($plugin);
        if (!isset(self::$pluggableApplications[$plugin])) {
            throw new AtomikException("Plugin '$plugin' is not registered as a pluggable application");
        }
        
        $route = rtrim(self::$pluggableApplications[$plugin]['route'], '/*');
        return self::url($route . '/' . ltrim($action, '/'), $params, $useIndex, false);
    }
362340
public function getAssetUri( $asset ) {
		// Path with unix-style slashes.
		$path = $this->manifest->get( $asset, '' );

		if ( ! $path ) {
			return '';
		}

		return $this->getThemeUri() . '/' . APP_DIST_DIR_NAME . '/' . $path;
	}
344758
protected function _getPluginPath($plugin)
    {
        if (!Plugin::loaded($plugin)) {
            throw new MissingPluginException('Plugin ' . $plugin . ' is not loaded.');
        }
        $pluginPath = Plugin::path($plugin);

        return $pluginPath;
    }