Returns an array of Themes that can be updated.
The Themes are extended with the `available` property that relies to the remote version
@return array Array of updatable Themes
977417
public function getUpdatableThemes()
    {
        $items = [];
        $repository = $this->repository['themes'];

        // local cache to speed things up
        if (isset($this->cache[__METHOD__])) {
            return $this->cache[__METHOD__];
        }

        foreach ($this->installed['themes'] as $slug => $plugin) {
            if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) {
                continue;
            }

            $local_version = $plugin->version ?: 'Unknown';
            $remote_version = $repository[$slug]->version;

            if (version_compare($local_version, $remote_version) < 0) {
                $repository[$slug]->available = $remote_version;
                $repository[$slug]->version = $local_version;
                $repository[$slug]->type = $repository[$slug]->release_type;
                $items[$slug] = $repository[$slug];
            }
        }

        $this->cache[__METHOD__] = $items;

        return $items;
    }
406279
public function all()
	{
		$themes = array();
		foreach ($this->paths as $path)
		{
			$iterator = new \GlobIterator($path.'*');
			foreach($iterator as $theme)
			{
				$themes[] = $theme->getFilename();
			}
		}
		sort($themes);

		return $themes;
	}
115771
public function scanThemes()
    {

        $parentThemes = [];
        $themesConfig = config('themes.themes', []);

        foreach ($this->loadThemesJson() as $data) {
            // Are theme settings overriden in config/themes.php?
            if (array_key_exists($data['name'], $themesConfig)) {
                $data = array_merge($data, $themesConfig[$data['name']]);
            }

            // Create theme
            $theme = new Theme(
                $data['name'],
                $data['asset-path'],
                $data['views-path']
            );

            // Has a parent theme? Store parent name to resolve later.
            if ($data['extends']) {
                $parentThemes[$theme->name] = $data['extends'];
            }

            // Load the rest of the values as theme Settings
            $theme->loadSettings($data);
        }

        // Add themes from config/themes.php
        foreach ($themesConfig as $themeName => $themeConfig) {

            // Is it an element with no values?
            if (is_string($themeConfig)) {
                $themeName = $themeConfig;
                $themeConfig = [];
            }

            // Create new or Update existing?
            if (!$this->exists($themeName)) {
                $theme = new Theme($themeName);
            } else {
                $theme = $this->find($themeName);
            }

            // Load Values from config/themes.php
            if (isset($themeConfig['asset-path'])) {
                $theme->assetPath = $themeConfig['asset-path'];
            }

            if (isset($themeConfig['views-path'])) {
                $theme->viewsPath = $themeConfig['views-path'];
            }

            if (isset($themeConfig['extends'])) {
                $parentThemes[$themeName] = $themeConfig['extends'];
            }

            $theme->loadSettings(array_merge($theme->settings, $themeConfig));
        }

        // All themes are loaded. Now we can assign the parents to the child-themes
        foreach ($parentThemes as $childName => $parentName) {
            $child = $this->find($childName);

            if ($this->exists($parentName)) {
                $parent = $this->find($parentName);
            } else {
                $parent = new Theme($parentName);
            }

            $child->setParent($parent);
        }
    }
98824
protected function getUpdateableStatuses()
    {
        return $this->hasOption(self::OPTION_UPDATEABLE_STATUSES)
            ? $this->getOption(self::OPTION_UPDATEABLE_STATUSES)
            : [
                DeliveryExecution::STATE_ACTIVE,
                DeliveryExecution::STATE_PAUSED,
            ];
    }
830204
public function getDiff()
    {
        $diff = [];

        foreach ($this->getUpdated() as $key) {
            $diff[$key]['old'] = $this->old($key);

            $diff[$key]['new'] = $this->new($key);
        }

        return $diff;
    }
81419
public function getChildrenUpdaters(): array {
        $key = get_class($this);
        if(!array_key_exists($key, self::$childrenUpdaters)) {
            return [];
        }
        return self::$childrenUpdaters[$key];
    }
360233
public function getInstalledThemes(): array
    {
        $installed = $this->cache->get($this->cacheKey);

        if ($installed !== null) {
            return $installed;
        }

        return $this->findAndInstallThemes();
    }
988552
protected function upgrade_options() {
		// Pre-0.4.0 options array to 0.5.0+ individual option entries.
		$old_options = (array) $this->options->get_store()->get( 'settings', [] );

		if ( isset( $old_options['email_address'] ) ) {
			$sanitized = sanitize_email( $old_options['email_address'] );

			if ( $sanitized ) {
				$this->options->get_store()->set( 'email_address', $old_options['email_address'] );
			}
		}

		if ( isset( $old_options['html_email'] ) && $old_options['html_email'] ) {
			$this->options->get_store()->set( 'email_type', 'html' );
		}

		if (
			isset( $old_options['ignored_plugins'] )
			&& is_array( $old_options['ignored_plugins'] )
		) {
			$ignored_plugins = $this->prepare_ignored_plugins( $old_options['ignored_plugins'] );

			if ( ! empty( $ignored_plugins ) ) {
				$this->options->get_store()->set( 'ignored_plugins', $ignored_plugins );
			}
		}

		if (
			isset( $old_options['ignored_themes'] )
			&& is_array( $old_options['ignored_themes'] )
		) {
			$ignored_themes = $this->prepare_ignored_themes( $old_options['ignored_themes'] );

			if ( ! empty( $ignored_themes ) ) {
				$this->options->get_store()->set( 'ignored_themes', $ignored_themes );
			}
		}

		// These options don't technically get set because they are the same as the
		// defaults we have defined in the options manager class...
		$this->options->get_store()->set( 'email_enabled', 'yes' );
		$this->options->get_store()->set( 'last_scan_hash', '' );
		$this->options->get_store()->set( 'should_nag', 'yes' );
		$this->options->get_store()->set( 'slack_enabled', 'no' );
		$this->options->get_store()->set( 'slack_url', '' );

		$this->options->get_store()->delete( 'settings' );
	}
871425
public function editAction()
    {
        $themeId = $this->getEvent()->getRouteMatch()->getParam('themeId');
        $theme = $this->getAdminThemeService()->findById($themeId);

        $form = $this->getServiceLocator()->get('playgrounddesign_theme_form');

        $request = $this->getRequest();

        $form->bind($theme);

        if ($request->isPost()) {
            $data = array_merge(
                $request->getPost()->toArray(),
                $request->getFiles()->toArray()
            );

            $theme = $this->getAdminThemeService()->edit($data, $theme, 'playgrounddesign_theme_form');

            if ($theme) {
                $this->flashMessenger()->addMessage('The theme "'.$theme->getTitle().'" was updated');

                return $this->redirect()->toRoute('admin/playgrounddesign_themeadmin');
            } else {
                $this->flashMessenger()->addMessage('The theme was not updated');

                return $this->redirect()->toRoute('admin/playgrounddesign_themeadmin');
            }
        }

        $viewModel = new ViewModel();
        $viewModel->setTemplate('playground-design/theme-admin/theme');

        return $viewModel->setVariables(array('form'           => $form,
                                              'automaticTheme' => 0));
    }
1165151
public function getThemesFromDir()
	{
		$themeList = array();
		$themePath = Yii::getPathOfAlias('webroot.themes');
		$themes    = scandir($themePath);
		foreach($themes as $theme) {
			$themeName = $this->urlTitle($theme);
			$themeFile = $themePath.'/'.$theme.'/'.$themeName.'.yaml';
			if(file_exists($themeFile)) {
				if(!in_array($themeName, $this->getIgnoreTheme())) {
					$themeList[] = $theme;
				}
			}
		}

		if(count($themeList) > 0)
			return $themeList;
		else
			return false;
	}
226374
public function getActiveThemes()
    {
        $themes = &gplcart_static('module.active.themes');

        if (isset($themes)) {
            return $themes;
        }

        $themes = array($this->config->get('theme_backend', 'backend'));

        if (!$this->db->isInitialized()) {
            return $themes;
        }

        $stores = $this->db->fetchAll('SELECT * FROM store', array());

        foreach ($stores as $store) {
            $data = unserialize($store['data']);
            foreach ($data as $key => $value) {
                if (strpos($key, 'theme') === 0) {
                    $themes[] = $value;
                }
            }
        }

        return $themes;
    }
417820
public function onCheckForUpdates()
    {
        try {
            $manager = UpdateManager::instance();
            $result = $manager->requestUpdateList();

            $result = $this->processUpdateLists($result);
            $result = $this->processImportantUpdates($result);

            $this->vars['core'] = array_get($result, 'core', false);
            $this->vars['hasUpdates'] = array_get($result, 'hasUpdates', false);
            $this->vars['hasImportantUpdates'] = array_get($result, 'hasImportantUpdates', false);
            $this->vars['pluginList'] = array_get($result, 'plugins', []);
            $this->vars['themeList'] = array_get($result, 'themes', []);
        }
        catch (Exception $ex) {
            $this->handleError($ex);
        }

        return ['#updateContainer' => $this->makePartial('update_list')];
    }
280607
protected function getThemeIdFromThemeDetailsProviders()
    {
        $providers = $this->getThemeDetailsProviders();
        foreach ($providers as $provider) {
            if ($provider instanceof ThemeDetailsProviderInterface) {
                $themeId = $provider->getThemeId();
                if (!empty($themeId) && $themeId !== ' ') {
                    if ($this->hasTheme($themeId)) {
                        return $themeId;
                    }

                    \common_Logger::i(
                        'The requested theme ' . $themeId .
                        ' requested by the ' . get_class($provider) . ' provider does not exist!'
                    );
                }
            }
        }

        return '';
    }
830342
public function getReplacements()
    {
        $repository = parent::getRootNamespace() . parent::getConfigGeneratorClassPath('interfaces') . '\\' . $this->name . 'Repository;';
        $repository = str_replace([
            "\\",
            '/'
        ], '\\', $repository);

        return array_merge(parent::getReplacements(), [
            'fillable'      => $this->getFillable(),
            'use_validator' => $this->getValidatorUse(),
            'validator'     => $this->getValidatorMethod(),
            'use_presenter' => $this->getPresenterUse(),
            'root_namespace' => parent::getRootNamespace(),
            'presenter'     => $this->getPresenterMethod(),
            'repository'    => $repository,
            'model'         => isset($this->options['model']) ? $this->options['model'] : ''
        ]);
    }
212859
public function extend() 
    {
        // set default mode in case its invalid
        $mode = $this->getAttribute("mode");
        if (! $mode || ! in_array($mode, [self::MODE_ACTIVATE, self::MODE_DEACTIVATE])) {
            $mode = self::MODE_ACTIVATE;
            $this->setAttribute("mode", $mode);
        }

        return [
            "remoteAccount" => $this->remoteAccount()->publicKey,
            "mode" => $this->mode,
            // transaction type specialization
            "type"      => TransactionType::IMPORTANCE_TRANSFER,
        ];
    }
702839
public function getReplacements()
    {

        return array_merge(parent::getReplacements(), [
            'repository' => $this->getRepository(),
            'eloquent' => $this->getEloquentRepository(),
            'placeholder' => $this->bindPlaceholder,
        ]);
    }
508455
protected function getUpdatedEventAttributes(): array
    {
        $old = [];
        $new = [];

        foreach ($this->getDirty() as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = Arr::get($this->original, $attribute);
                $new[$attribute] = Arr::get($this->attributes, $attribute);
            }
        }

        return [
            $old,
            $new,
        ];
    }