/** * Stores how many decent nodes are under a parent node * * @param Element $node * @param int $addToCount */ private function updateNodeCount(Element $node, $addToCount) { $currentScore = (int) $node->attr('gravityNodes'); $node->attr('gravityNodes', $currentScore + $addToCount); }
/** * will check the image src against a list of bad image files we know of like buttons, etc... * * @param Element $imageNode * * @return bool */ private function isOkImageFileName(Element $imageNode) { $imgSrc = $imageNode->attr('src'); if (empty($imgSrc)) { return false; } $regex = '@' . implode('|', $this->badFileNames) . '@i'; if (preg_match($regex, $imgSrc)) { return false; } return true; }