增加插件的资源

@param string|null $action
@param string|null $plugin
@param bool $hasCss
@return $this
@deprecated
558891
public function addPluginAsset($action = null, $plugin = null, $hasCss = true)
    {
        // 1. 设置路由
        $this->initRoute($action);

        // 2. 加载插件的版本映射表
        // 目前正常只会加载一次，不用缓存
        $plugin || $plugin = $this->app->getPlugin();
        $this->wpAsset->addRevFile('dist2/' . $plugin . '-assets-hash.json');

        // 3. 加载css和js文件
        $hasCss && $this->addCss($this->wpAsset($plugin . '.css'));
        $this->addJs($this->wpAsset($plugin . '.js'));

        return $this;
    }
926467
public function factory($module, $action)
    {
        if (empty($module) || empty($action)) {
            return;
        }

        try {
            if (!$this->pluginManager->isPluginActivated($module)) {
                return;
            }

            $plugin = $this->pluginManager->getLoadedPlugin($module);
        } catch (\Exception $e) {
            // we are not allowed to use possible widgets, plugin is not active
            return;
        }

        /** @var Widget[] $widgetContainer */
        $widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget');

        foreach ($widgets as $widgetClass) {
            $config = $this->getWidgetConfigForClassName($widgetClass);
            if ($config->getAction() === $action) {
                $config->checkIsEnabled();
                return StaticContainer::get($widgetClass);
            }
        }
    }
798200
public function plugins_api( $false, $action, $response ) {
		if ( ! ( 'plugin_information' === $action ) ) {
			return $false;
		}

		$plugin = isset( $this->config[ $response->slug ] ) ? $this->config[ $response->slug ] : false;

		// Skip if waiting for background update.
		if ( $this->waiting_for_background_update( $plugin ) ) {
			return $false;
		}

		// wp.org plugin.
		if ( ! $plugin || ( $plugin->dot_org && 'master' === $plugin->branch ) ) {
			return $false;
		}

		$response->slug          = $plugin->slug;
		$response->plugin_name   = $plugin->name;
		$response->name          = $plugin->name;
		$response->author        = $plugin->author;
		$response->homepage      = $plugin->uri;
		$response->donate_link   = $plugin->donate_link;
		$response->version       = $plugin->remote_version;
		$response->sections      = $plugin->sections;
		$response->requires      = $plugin->requires;
		$response->requires_php  = $plugin->requires_php;
		$response->tested        = $plugin->tested;
		$response->downloaded    = $plugin->downloaded;
		$response->last_updated  = $plugin->last_updated;
		$response->download_link = $plugin->download_link;
		$response->banners       = $plugin->banners;
		$response->icons         = ! empty( $plugin->icons ) ? $plugin->icons : [];
		$response->contributors  = $plugin->contributors;
		if ( ! $this->is_private( $plugin ) ) {
			$response->num_ratings = $plugin->num_ratings;
			$response->rating      = $plugin->rating;
		}

		return $response;
	}
1053478
protected function assetBaseUrl($plugin, $asset)
    {
        $dir  = dirname($asset);
        $path = !empty($dir) && $dir != '.' ? "/$dir" : null;

        return $this->Url->assetUrl($plugin . $path);
    }
649831
public function add($type, $rule, $action, $options = null) {
		$add = [];
		if (strpos($rule, '{') !== false) {
			$param = [];
			$regex = str_replace('/', '\\/', $rule);
			$regex = preg_replace_callback('/\{([a-zA-Z0-9_]+)\}/', function($matches) use (&$param, &$options) {
				$paramName = $matches[1];
				$param[] = $paramName;
				if (is_array($options) && isset($options[$paramName])) {
					return $options[$paramName];
				} else {
					return '([^\/]+)';
				}
			}, $regex);
			$regex = '/^' . $regex . '$/';
			$add['regex'] = $regex;
			$add['param'] = $param;
		} else {
			$add['uri'] = $rule;
		}
		if (!isset($this->routes[$type])) {
			$this->routes[$type] = [];
		}
		if (is_string($action)) {
			$res = explode('.', $action, 3);
			if (count($res) === 3) {
				$add['dispatch'] = [
					'module' => $res[0],
					'controller' => $res[1],
					'action' => $res[2]
				];
			} else {
				$add['dispatch'] = [
					'controller' => $res[0],
					'action' => $res[1]
				];
			}
		} else {
			$add['dispatch'] = $action;
		}
		$this->routes[$type][] = $add;
	}
1212083
public function register_actions( HasActions $service ) {
		foreach ( $service->action_hooks() as $action ) {
			$this->actions = $this->add(
				$this->actions,
				$action['hook'],
				$service,
				$action['method'],
				isset( $action['priority'] ) ? $action['priority'] : 10,
				isset( $action['args'] ) ? $action['args'] : 1
			);
		}
	}
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
500400
protected function executing($action, $plugin)
    {
        $this->io->write('  - ' . ucfirst($this->getActionExecuting($action)) . ' plugin <info>' . $plugin . '</info>');
        $this->io->write('');
    }
382246
public function addActions($actions, $title = null, $icon = null, $showTitle = false)
    {
        if ($actions) {
            $this->actions[] = [
                'title'     => $title,
                'icon'      => $icon,
                'showTitle' => empty($icon) ? true : $showTitle,
                'actions'   => $actions,
                'raw'       => (!is_array($actions) || !reset($actions) instanceof Action)
            ];
        }

        return $this;
    }
254813
public function action($action = null)
    {
        if ($action === null) {
            return $this->clause('action');
        }

        $this->_parts['action'] = $action;

        return $this;
    }
961671
public static function navbarForm($action, $method = 'post', $htmlOptions = array())
    {
        self::addCssClass('navbar-form', $htmlOptions);
        return self::form($action, $method, $htmlOptions);
    }
549375
public function addAction($action, $actionParams)
    {
        // check if valid rule usage for object_type_id
        $this->validateRule("Actions", $action);
        // get required parameters for specific rule
        $requiredParams = Actions::GetRequiredParams($action);
        // checking for missing and invalid parameters
        $exception = false;
        if ($action == Actions::PING_URL)
        {
            $exception = true;
        }
        $check_params = $this->_checkParams($requiredParams, $actionParams, $exception);
        // if no missing or invalid rule parameters
        if ($check_params)
        {
            $rule = $action;
            // special formatting for ping_url
            if ($action == Actions::PING_URL)
            {
                $formatted = $this->_formatParams($actionParams, "::");
                $this->_actions[] = $action . "(" . $formatted . ")";

                return $this->_actions;
            }
            // general formatting for actions
            $value = $this->_formatParams($actionParams);
            $formatted = "(" . $value . ")";
            $this->_actions[] = $rule . $formatted;

            return $this->_actions;
        }
        return false;
    }
410621
protected function invokeControllerAction(AbstractController $controller, $action)
    {
        $this->invokePluginsHook(
            'beforeActionInvoked',
            array($this, $this->getRequest(), $controller, $action)
        );
        $response = $controller->$action($this->routeParams);
        if (null === $response) {
            // if the action returns null, we simply render the default view
            $response = array();
        } elseif (!is_string($response)) {
            // if they don't return a string, try to use whatever is returned
            // as variables to the view renderer
            $response = (array)$response;
        }

        // merge the response variables with the existing view context
        if (is_array($response)) {
            $response = array_merge($controller->getViewContext(), $response);
        }

        // whatever we have as a response needs to be encapsulated in an
        // AbstractResponse object
        if (!($response instanceof AbstractResponse)) {
            $response = new Response($response);
        }
        $this->invokePluginsHook(
            'afterActionInvoked',
            array($this, $this->getRequest(), $controller, $action, $response)
        );
        return $response;
    }
298433
public function addMbAction($actionName, $action = null)
    {
        $mbAction = new MbAction($this, $actionName);
        $mbAction->actionResolver($action);

        return $this->setMbAction($mbAction);
    }
1298876
public function addCss($asset)
	{
		if(is_array($asset))
		{
			foreach($asset as $a)
				$this->addCss($a);

			return $this;
		}

		if( ! $this->isRemoteLink($asset))
			$asset = $this->buildLocalLink($asset, $this->css_dir);

		if( ! in_array($asset, $this->css))
			$this->css[] = $asset;

		return $this;
	}
67403
public function addCssFile($asset, array $options = [], $key = null)
    {
        if (!isset($options['position'])) {
            $options['position'] = self::POS_HEAD;
        }

        return $this->loggingFileAsset($asset, self::ASSET_CSS_FILE, $options, $key);
    }
483632
public function beforeAction($action)
    {   
        // Are we trying to load the index page? Check we have defaults setup
        if ($action->actionMethod === 'actionIndex') {
            $layoutId = $this->_getCurrentLayoutId();

            $navItems = CpNav::$plugin->navigationService->getByLayoutId($layoutId);

            if (!$navItems) {
                CpNav::$plugin->cpNavService->setupDefaults();
            }
        }

        return parent::beforeAction($action);
    }