Persists to disk the theme parameters currently stored in the Grav Config object

@param string $theme_name The name of the theme whose config it should store.

@return true
2930
public static function saveConfig($theme_name)
    {
        if (!$theme_name) {
            return false;
        }

        $grav = Grav::instance();
        $locator = $grav['locator'];
        $filename = 'config://themes/' . $theme_name . '.yaml';
        $file = YamlFile::instance($locator->findResource($filename, true, true));
        $content = $grav['config']->get('themes.' . $theme_name);
        $file->save($content);
        $file->free();

        return true;
    }
617314
public function ensureDir($dir_name)
    {
        if (is_dir($dir_name) || @mkdir($dir_name)) {
            return true;
        } else {
            $parent_dir = dirname($dir_name);

            // Terminal case; there is no parent directory to create.
            if ($parent_dir == $dir_name) {
                return true;
            }

            return (Auth_OpenID::ensureDir($parent_dir) && @mkdir($dir_name));
        }
    }
232613
public function hasBundle($name) {
        if (isset($this->_globalConfig['bundles'][$name])) {
            return true;
        } else {
            foreach ($this->_bundleConfig as $value) {
                if ($value['short_name'] == $name) {
                    return true;
                }
            }
            return false;
        }
    }
1231525
public function remove_after_theme_row( $theme_key, $theme ) {
		$themes = $this->get_theme_configs();

		foreach ( static::$git_servers as $server ) {
			$repo_header = $server . ' Theme URI';
			$repo_uri    = $theme->get( $repo_header );

			/**
			 * Filter to add themes not containing appropriate header line.
			 *
			 * @since   5.4.0
			 * @access  public
			 *
			 * @param array $additions Listing of themes to add.
			 *                         Default null.
			 * @param array $themes    Listing of all themes.
			 * @param         string        'theme'    Type being passed.
			 */
			$additions = apply_filters( 'github_updater_additions', null, $themes, 'theme' );
			foreach ( (array) $additions as $addition ) {
				if ( $theme_key === $addition['slug'] ) {
					if ( ! empty( $addition[ $server . ' Theme URI' ] ) ) {
						$repo_uri = $addition[ $server . ' Theme URI' ];
						break;
					}
				}
			}
			if ( empty( $repo_uri ) ) {
				continue;
			}
			break;
		}
		if ( array_key_exists( $theme_key, $themes ) ) {
			remove_action( "after_theme_row_$theme_key", 'wp_theme_update_row' );
		}
	}
223666
public static function get_menu_name($theme_location)
    {
        $menu_obj = static::get_menu_object($theme_location);

        if ($menu_obj !== false) {
            return $menu_obj->name;
        }

        return false;
    }
923211
private function buildGravatarConfig(ThemeModel $theme, array $config): array
    {
        $file = FilesModel::findByPk($theme->bs_gravatar_default);

        if ($file) {
            $config['gravatar']['default'] = Environment::get('base') . $file->path;
        }

        if ($theme->bs_gravatar_size) {
            $config['gravatar']['size'] = (int) $theme->bs_gravatar_size;
        }

        return $config;
    }
751282
protected function isIncluded($_name)
    {
        for ($i = 0, $_i = count($this->includes); $i < $_i; $i++) {
            if ($this->matchPath($this->includes[$i], $_name, $this->isCaseSensitive)) {
                return true;
            }
        }

        return false;
    }
281614
public function store($module, $name, $value)
    {
        $this->initializeOnDemand();

        if (!$this->has($module, $name)) {
            if ($this->configMapper->insert($module, $name, $value)) {
                $this->arrayConfig->add($module, $name, $value);
                return true;
            }

        } else {
            if ($this->configMapper->update($module, $name, $value)) {
                $this->arrayConfig->update($module, $name, $value);
                return true;
            }
        }

        // By default
        return false;
    }
766787
public static function get_theme_field( $field_name, $default = false ) {

		if ( ! empty( self::$theme ) ) {
			return self::$theme->get( $field_name );
		}

		return $default;
	}
590521
public function hasFlag(string $name): bool
    {
        $flags = array();
        $flagEntry = $this->entry[PoTokens::FLAG];
        if (!empty($flagEntry)) {
            foreach ((array) $flagEntry as $csv) {
                $temp = str_getcsv($csv, ',');
                foreach ($temp as $flag) {
                    $flag = strtolower(trim($flag));
                    $flags[$flag] = $flag;
                }
            }
            return isset($flags[strtolower(trim($name))]);
        }
        return false;
    }
618905
public function exists($storage_name, $key = null)
    {
        // No app found = false
        if (!isset($this->storage[$storage_name])) {
            return false;
        }

        // app found and no key requested? true
        if (!isset($key)) {
            return true;
        }

        // key requested and found? true
        return isset($this->storage[$storage_name]->{$key}) && !empty($this->storage[$storage_name]->{$key});
    }
642599
public function isSaved( string $name ): bool
	{
		if (realpath($this->cacheDir . DIRECTORY_SEPARATOR . $name) == false)
			return false;

		/** @var FileCacheStorage $storage */
		$storage = $this->load($name, true);
		return $storage->expires_at > time();
	}
77555
public function saveFile($file_name) {
    $path = 'public://govcms8-demo';
    if (file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
      $source = DRUPAL_ROOT . '/' . drupal_get_path('module', 'govcms8_default_content') . '/import/images/' . $file_name;
      $data = file_get_contents($source);
      return file_save_data($data, "public://govcms8-demo/" . $file_name, FILE_EXISTS_RENAME);
    }
  }
1054647
public function hasParameter(string $name): bool
    {
        return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
    }
33689
private static boolean checkThemeFile(final String name) {
		return !(Util.empty(name) // name must exist
				|| name.contains("..") // prevent directory traversal
				|| name.charAt(0) == '/' // all theme references should be relative
				|| name.indexOf(':') != -1 // forbid use of protocols such as jar:, http: etc.
				);
	}
149130
public static function find($name)
    {
        if (!is_dir(DOCROOT.THEME_DIR.'/'.$name)) return false;
        if (!file_exists(DOCROOT.THEME_DIR.'/'.$name.'/'.THEME_INFO)) return false;
        return new self($name);
    }
16285
public function _set($_name,$_value)
    {
        $setMethod = 'set' . ucfirst($_name);
        if(method_exists($this,$setMethod))
        {
            $this->$setMethod($_value);
            return true;
        }
        else
            return false;
    }