Get widgets defined in the Application level (src/Template/Plugin/Search/AppWidgets).

@return mixed[]
164162
protected function _getAppWidgets(): array
    {
        $result = [];

        $paths = App::path('Template');
        $tree = ['Plugin', 'Search', 'Widgets'];
        foreach ($paths as $path) {
            $path .= 'Element' . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $tree) . DIRECTORY_SEPARATOR;

            $dir = new Folder($path);
            $files = $dir->find('.*\.ctp');
            if (empty($files)) {
                continue;
            }

            foreach ($files as $file) {
                $element = implode('/', $tree) . '/' . str_replace('.ctp', '', $file);

                $name = str_replace('.ctp', '', $file);
                $name = Inflector::humanize($name);
                $result[] = [
                    'name' => $name,
                    'type' => static::WIDGET_TYPE,
                    'content' => [
                        'model' => $this->getAlias(),
                        'path' => $path . $file,
                        'element' => $element
                    ]
                ];
            }
        }

        return $result;
    }
609078
public function getMissingPlugins()
    {
        $missingPlugins = array();

        $plugins = $this->pluginList->getActivatedPlugins();

        foreach ($plugins as $pluginName) {
            // if a plugin is listed in the config, but is not loaded, it does not exist in the folder
            if (!$this->isPluginLoaded($pluginName) && !$this->isPluginBogus($pluginName) &&
                !($this->doesPluginRequireInternetConnection($pluginName) && !SettingsPiwik::isInternetEnabled())) {
                $missingPlugins[] = $pluginName;
            }
        }

        return $missingPlugins;
    }
547477
private static function getStockWidgets ()
    {
        $reflectionClass = new \ReflectionClass(get_class());
        $classNames      = array();
        foreach ($reflectionClass->getConstants() as $name => $value)
            if (preg_match('/^STOCK_WP/', $name))
                $classNames[] = $value;
        return $classNames;
    }
735143
public function getWidget()
    {
        if ($this->widget === null) {
            $this->widget = $this->createWidget();
        }

        return $this->widget;
    }
66840
public function formProperties()
    {
        $sidebars = $this->sidebars;
        if (!is_array($sidebars)) {
            yield null;
        } else {
            foreach ($this->formProperties as $formProperty) {
                if ($formProperty->active() === false) {
                    continue;
                }

                $GLOBALS['widget_template'] = $formProperty->inputType();

                yield $formProperty->propertyIdent() => $formProperty;

                $GLOBALS['widget_template'] = '';
            }
        }
    }
261540
protected function getOptions()
    {
        $path = public_path($this->config->get('theme.themeDir'));

        return array(
            array('path', 'p', InputOption::VALUE_OPTIONAL, 'Path to theme directory.', $path),
            array('type', 't', InputOption::VALUE_OPTIONAL, 'Widget view type [php|blade|twig].', null),
            array('global', 'g', InputOption::VALUE_NONE, 'Create global widget.', null)
        );
    }
787730
public function widgetDataForJs()
    {
        return [
            'obj_type'         => $this->objType(),
            'template'         => $this->template(),
            'collection_ident' => $this->collectionIdent(),
            'properties'       => $this->propertiesIdents(),
            'filters'          => $this->filters(),
            'orders'           => $this->orders(),
            'list_actions'     => $this->listActions(),
            'object_actions'   => $this->rawObjectActions(),
            'pagination'       => $this->pagination(),
        ];
    }
1024978
public static function getStatics()
    {
        return array(
            'aliases' => self::$aliases,
            'app_root_dirs' => self::$app_root_dirs,
            'cli_detection' => self::$cli_detection,
            'display_called_from' => self::$display_called_from,
            'enabled_mode' => self::$enabled_mode,
            'expanded' => self::$expanded,
            'file_link_format' => self::$file_link_format,
            'max_depth' => self::$max_depth,
            'mode_default' => self::$mode_default,
            'mode_default_cli' => self::$mode_default_cli,
            'plugins' => self::$plugins,
            'renderers' => self::$renderers,
            'return' => self::$return,
        );
    }
523101
public function getWidgetStaticContent(Widget $widget)
    {
        $reflect = new \ReflectionClass($widget);
        $widgetProperties = $reflect->getProperties();
        $parameters = ['widget' => $widget];
        $accessor = PropertyAccess::createPropertyAccessor();

        foreach ($widgetProperties as $property) {
            if (!$property->isStatic()) {
                $value = $accessor->getValue($widget, $property->getName());
                $parameters[$property->getName()] = $value;
            }
        }

        return $parameters;
    }
388365
public function getWidgetOptions() {
    $options = new \stdClass;
    foreach (array('width','height','disabled','scrollAnimationDuration','enabledHover','collapsible','animationType','enableScrollAnimation','contentTransitionDuration','toggleMode','selectedItem','position','selectionTracker','scrollable','scrollPosition','scrollStep','autoHeight','showCloseButtons','closeButtonSize','initTabContent','keyboardNavigation','reorder','enableDropAnimation','dropAnimationDuration') as $option) {
      if ($this->$option !== "__spec__undefined") {
        $options->$option = $this->$option;
      }
    }
    return $options;
  }
430321
public function filter()
    {
        $widgets = $this->applyFilters();

        return $widgets->sortBy(function (AbstractWidget $w1) {
            return $w1->getOrder();
        });
    }
153256
public function getApplicationModules()
    {
        $modules = [];

        foreach ($this->getModules() as $id => $obj) {
            if ($obj instanceof Module) {
                $modules[$id] = $obj;
            }
        }

        return $modules;
    }
523266
public function getOrder($widgets)
    {
        $orderedWidgets = [];

        foreach ($widgets as $widget) {
            $orderedWidgets[$widget->getCol().$widget->getRow()] = $widget;
        }

        ksort($orderedWidgets);

        return $orderedWidgets;
    }
851343
public final function createWidgets() {
        if ($this->_widgets !== null) {
            return $this->_widgets;
        }
        $this->beforeCreateWidgets();
        $this->_widgets = [];
        foreach ($this->_fields as $key => $field) {
            if (isset($this->_excludes[ $key ])) {
                continue;
            }
            $cls = $field['var'];
            if ($cls && is_subclass_of($cls, FormField::class)) {
                /**@var \wulaphp\form\FormField $clz */
                $clz       = new $cls($key, $this, $field);
                $fieldName = $field['name'];
                if (isset($this->_tableData[ $fieldName ])) {
                    $clz->setValue($this->_tableData[ $fieldName ]);
                } else {
                    $clz->setValue($field['default']);
                }
                $this->_widgets[ $key ] = $clz;
            }
        }

        return $this->_widgets;
    }
379336
public function getFunctions(): array
    {
        return [
            new TwigFunction('elementExists', function ($name) {
                return $this->view->elementExists($name);
            }),
            new TwigFunction('getVars', function () {
                return $this->view->getVars();
            }),
            new TwigFunction('get', function ($var, $default = null) {
                return $this->view->get($var, $default);
            }),
        ];
    }
1278336
public static function get_all_areas() {
		global $sidebars_widgets;

		$widget_areas = [];

		foreach ( $sidebars_widgets as $widget_area => $widgets ) {
			if ( 'wp_inactive_widgets' === $widget_area ) {
				continue;
			}

			$widget_areas[ $widget_area ] = [];

			if ( empty( $widgets ) ) {
				continue;
			}

			foreach ( $widgets as $widget ) {
				$model = Register::get_widget_instance( $widget );

				if ( ! $model ) {
					continue;
				}

				$widget_areas[ $widget_area ][] = [
					'type' => $model->get_slug(),
					'content' => $model->get_data(),
				];
			}
		}

		return $widget_areas;
	}
1283139
public static function get()
    {
        $list = new static;

        $widgets = StaticContainer::get('Piwik\Plugin\WidgetsProvider');

        $widgetContainerConfigs = $widgets->getWidgetContainerConfigs();
        foreach ($widgetContainerConfigs as $config) {
            if ($config->isEnabled()) {
                $list->addWidgetConfig($config);
            }
        }

        $widgetConfigs = $widgets->getWidgetConfigs();
        foreach ($widgetConfigs as $widget) {
            if ($widget->isEnabled()) {
                $list->addWidgetConfig($widget);
            }
        }

        $reports = StaticContainer::get('Piwik\Plugin\ReportsProvider');
        $reports = $reports->getAllReports();
        foreach ($reports as $report) {
            if ($report->isEnabled()) {
                $factory = new ReportWidgetFactory($report);
                $report->configureWidgets($list, $factory);
            }
        }

        /**
         * Triggered to filter widgets.
         *
         * **Example**
         *
         *     public function removeWidgetConfigs(Piwik\Widget\WidgetsList $list)
         *     {
         *         $list->remove($category='General_Visits'); // remove all widgets having this category
         *     }
         *
         * @param WidgetsList $list An instance of the WidgetsList. You can change the list of widgets this way.
         */
        Piwik::postEvent('Widget.filterWidgets', array($list));

        return $list;
    }