public function getGoals($idSite)
    {
        $cacheId = self::getCacheId($idSite);
        $cache = $this->getGoalsInfoStaticCache();
        if (!$cache->contains($cacheId)) {
            // note: the reason this is secure is because the above cache is a static cache and cleared after each request
            // if we were to use a different cache that persists the result, this would not be secure because when a
            // result is in the cache, it would just return the result
            $idSite = Site::getIdSitesFromIdSitesString($idSite);

            if (empty($idSite)) {
                return array();
            }

            Piwik::checkUserHasViewAccess($idSite);

            $goals = $this->getModel()->getActiveGoals($idSite);

            $cleanedGoals = array();
            foreach ($goals as &$goal) {
                $cleanedGoals[$goal['idgoal']] = $this->formatGoal($goal);
            }

            $cache->save($cacheId, $cleanedGoals);
        }

        return $cache->fetch($cacheId);
    }
public function getGoals($idSite)
    {
        $cacheId = self::getCacheId($idSite);
        $cache = $this->getGoalsInfoStaticCache();
        if (!$cache->contains($cacheId)) {
            // note: the reason this is secure is because the above cache is a static cache and cleared after each request
            // if we were to use a different cache that persists the result, this would not be secure because when a
            // result is in the cache, it would just return the result
            $idSite = Site::getIdSitesFromIdSitesString($idSite);

            if (empty($idSite)) {
                return array();
            }

            Piwik::checkUserHasViewAccess($idSite);

            $goals = $this->getModel()->getActiveGoals($idSite);

            $cleanedGoals = array();
            foreach ($goals as &$goal) {
                $cleanedGoals[$goal['idgoal']] = $this->formatGoal($goal);
            }

            $cache->save($cacheId, $cleanedGoals);
        }

        return $cache->fetch($cacheId);
    }
public function getGoals ( $ idSite ) { $ cacheId = self :: getCacheId ( $ idSite ) ; $ cache = $ this -> getGoalsInfoStaticCache ( ) ; if ( ! $ cache -> contains ( $ cacheId ) ) { // note: the reason this is secure is because the above cache is a static cache and cleared after each request // if we were to use a different cache that persists the result, this would not be secure because when a // result is in the cache, it would just return the result $ idSite = Site :: getIdSitesFromIdSitesString ( $ idSite ) ; if ( empty ( $ idSite ) ) { return array ( ) ; } Piwik :: checkUserHasViewAccess ( $ idSite ) ; $ goals = $ this -> getModel ( ) -> getActiveGoals ( $ idSite ) ; $ cleanedGoals = array ( ) ; foreach ( $ goals as & $ goal ) { $ cleanedGoals [ $ goal [ 'idgoal' ] ] = $ this -> formatGoal ( $ goal ) ; } $ cache -> save ( $ cacheId , $ cleanedGoals ) ; } return $ cache -> fetch ( $ cacheId ) ; }
Returns all Goals for a given website, or list of websites

@param string|array $idSite Array or Comma separated list of website IDs to request the goals for
@return array Array of Goal attributes
Returns all Goals for a given website or list of websites