/** * Selects the targets : apply the selection to the builded targets * * @param array(CMS_page) $targets The build targets of which we want the selection * @return boolean true on success, false on failure * @access private */ protected function _selectTargets($targets) { $public_targets = array(); if (is_array($targets)) { foreach ($targets as $target) { if (!$this->_publicTree || $this->_publicTree && $target->isUseable() && $target->getPublication() == RESOURCE_PUBLICATION_PUBLIC) { $public_targets[] = $target; } } } $targets = $public_targets; if (!$targets || !$this->_selectionCondition) { return $targets; } $selected_targets = array(); $sizeofTargets = sizeof($targets); for ($i = 0; $i < $sizeofTargets; $i++) { $current_target = $targets[$i]; $pass = $this->_selectionCondition->pagePasses($this->_page, $current_target, $this->_publicTree, $i + 1); if ($pass) { $selected_targets[] = $current_target; } } return $selected_targets; }