Get all rules from a site

@param string $site
@return AnyDataset
431970
protected function getRolesFromSite($site)
	{
		$newDataSet = new AnyDataset();
		$it = $this->user->getRolesIterator($site);
		while ($it->hasNext()) {
			$sr = $it->moveNext();
			$dataArray = $sr->getFieldArray($this->user->getRolesTable()->Role);
			if (sizeof($dataArray) > 0) {
				foreach ($dataArray as $roles) {
					$siteName = $sr->getField($this->user->getRolesTable()->Site);
					if ($siteName == "_all") {
						$siteName = $this->myWords->Value("TEXT_ALLSITES");
					}
					$newDataSet->appendRow();
					$newDataSet->addField($this->user->getRolesTable()->Site, $siteName);
					$newDataSet->addField($this->user->getRolesTable()->Role, $roles);
				}	
			}
		}
		return $newDataSet;
	}
868822
protected function getRule($attribute, $rules)
	{
		if ( ! array_key_exists($attribute, $this->rules))
		{
			return;
		}

		$rules = (array) $rules;

		foreach ($this->rules[$attribute] as $rule)
		{
			list($rule, $parameters) = $this->parseRule($rule);

			if (in_array($rule, $rules)) return [$rule, $parameters];
		}
	}
1000837
protected function getSite()
    {
        $currentSite = $this->session->get(self::KEY_SITE);

        if (!$currentSite || (is_integer($currentSite['siteId']) && $currentSite['siteId'] == 0)) {
            $sites = $this->getAvailableSites();
            if (count($sites) > 0) {
                $site = array_shift($sites);
                $siteId = $site->getSiteId();
                $siteName = $site->getName();
                $locale = $site->getDefaultLanguage();
                $languages = $site->getLanguages();
                $this->setSite($siteId, $siteName, $locale, $languages);
                $currentSite = $this->session->get(self::KEY_SITE);
            }
        }

        return $currentSite;
    }
419562
public function get_all_samples(\core_analytics\analysable $site) {
        global $DB;

        // Getting courses from DB instead of from the site as these samples
        // will be stored in memory and we just want the id.
        $select = 'id != 1';
        $courses = get_courses('all', 'c.sortorder ASC');
        unset($courses[SITEID]);

        $courseids = array_keys($courses);
        $sampleids = array_combine($courseids, $courseids);

        $courses = array_map(function($course) {
            return array('course' => $course, 'context' => \context_course::instance($course->id));
        }, $courses);

        // No related data attached.
        return array($sampleids, $courses);
    }
62234
public function useSiteHashFromAllowedSites($allowedSites): QueryBuilder
    {
        $isAnySiteAllowed = trim($allowedSites) === '*';
        if ($isAnySiteAllowed) {
            // no filter required
            return $this;
        }

        $allowedSites = GeneralUtility::trimExplode(',', $allowedSites);
        $filters = [];
        foreach ($allowedSites as $site) {
            $siteHash = $this->siteHashService->getSiteHashForDomain($site);
            $filters[] = 'siteHash:"' . $siteHash . '"';
        }

        $siteHashFilterString = implode(' OR ', $filters);
        return $this->useFilter($siteHashFilterString, 'siteHash');
    }
203055
public function getStatisticsBySite(Site $site, $indexingConfigurationName = '')
    {
        return $this->queueStatisticsRepository->findOneByRootPidAndOptionalIndexingConfigurationName($site->getRootPageId(), $indexingConfigurationName);
    }
410288
public function hasSite(Site $site)
    {
        return $this->sites()
            ->where(SiteModel::ATTR_ID, '=', $site->getId())
            ->exists();
    }
512312
public static function getByLocale($locale, Site $site = null)
    {
        if (!$site) {
            $site = \Core::make('site')->getSite();
        }
        if ($locale) {
            if (!is_object($locale)) {
                $locale = explode('_', $locale);
                if (!isset($locale[1])) {
                    $locale[1] = '';
                }
                $em = Database::get()->getEntityManager();
                $locale = $em->getRepository('Concrete\Core\Entity\Site\Locale')
                    ->findOneBy(['site' => $site, 'msLanguage' => $locale[0], 'msCountry' => $locale[1]]);
            }

            if (is_object($locale)) {
                $obj = parent::getByID($locale->getSiteTree()->getSiteHomePageID(), 'RECENT');
                $obj->setLocale($locale);

                return $obj;
            }
        }

        return false;
    }
857541
public static function getDraftsParentPage(Site $site = null)
    {
        $db = Database::connection();
        $site = $site ? $site : \Core::make('site')->getSite();
        $cParentID = $db->fetchColumn('select p.cID from PagePaths pp inner join Pages p on pp.cID = p.cID inner join SiteLocales sl on p.siteTreeID = sl.siteTreeID where cPath = ? and sl.siteID = ?', [Config::get('concrete.paths.drafts'), $site->getSiteID()]);
        return Page::getByID($cParentID);
    }
25906
public function site($site)
    {
        $variables = array('site' => $site);
        $request = $this->get(array('{+base_path}/sites/{site}.json', $variables));
        return new Response\Site($request);
    }
984874
public function databases($site)
    {
        $variables = array('site' => $site);
        $request = $this->get(array('{+base_path}/sites/{site}/dbs.json', $variables));
        return new Response\DatabaseNames($request);
    }
308412
private function findAllMenuWithRole(Site $site, $role)
    {
        return $this->treeManager->getMenuStorage()->loadWithConditions([
            'site_id' => $site->getId(),
            'role'    => $role,
        ]);
    }
453020
private function parseSiteSettings(\DOMNode $site) {

		if(is_null($this->site)) {

			$this->site = new \stdClass;
			$this->site->use_nice_uris = FALSE;

		}

		foreach($site->childNodes as $node) {

			if($node->nodeType !== XML_ELEMENT_NODE) {
				continue;
			}

			$v = trim($node->nodeValue);
			$k = $node->nodeName;

			switch ($k) {

				case 'locales':
					if(!isset($this->site->locales)) {
						$this->site->locales = [];
					}

					foreach($node->getElementsByTagName('locale') as $locale) {
						$loc = $locale->getAttribute('value');
						if($loc && !in_array($loc, $this->site->locales)) {
							$this->site->locales[] = $loc;
						}
						if($loc && $locale->getAttribute('default') === '1') {
							$this->site->default_locale = $loc;
						}
					}

					break;

				case 'site->use_nice_uris':
					if($v === '1') {
						$this->site->use_nice_uris = TRUE;
					}
					break;

				default:
					$this->site->$k = $v;
			}

		}

	}
1179020
protected function getRule($attribute, $rules)
    {
        if (! array_key_exists($attribute, $this->rules)) {
            return;
        }

        $rules = (array) $rules;

        foreach ($this->rules[$attribute] as $rule) {
            [$rule, $parameters] = ValidationRuleParser::parse($rule);

            if (in_array($rule, $rules)) {
                return [$rule, $parameters];
            }
        }
    }
1260489
public function getRules($method = '')
    {
        if ('' === $method) {
            return $this->rules;
        }

        return isset($this->rules[strtolower($method)]) ? $this->rules[strtolower($method)] : [];
    }
516977
public static function createFromSite(Site $site): self
    {
        $message = new self();
        $message->setId($site->getId());
        $message->setHost($site->getHost());
        $message->setBillingStatus($site->getBillingStatus());
        $message->setContactEmail($site->getContactEmail());
        $message->setCompanyId($site->getCompanyId());
        $message->setThemeId($site->getThemeId());
        $message->setTitle($site->getTitle());

        return $message;
    }
878451
public function environments($site)
    {
        $variables = array('site' => $site);
        $request = $this->get(array('{+base_path}/sites/{site}/envs.json', $variables));
        return new Response\Environments($request);
    }