| @@ 171-186 (lines=16) @@ | ||
| 168 | /** |
|
| 169 | * @return \Closure |
|
| 170 | */ |
|
| 171 | protected function getOriginalIdCallback() |
|
| 172 | { |
|
| 173 | return function (Crawler $crawler) { |
|
| 174 | if ($selector = $this->getOriginalIdSelector()) { |
|
| 175 | if (preg_match('/^\/\//', $selector)) { |
|
| 176 | $node = $crawler->filterXPath($selector); |
|
| 177 | } else { |
|
| 178 | $node = $crawler->filter($selector); |
|
| 179 | } |
|
| 180 | ||
| 181 | return $node->html(); |
|
| 182 | } |
|
| 183 | ||
| 184 | return null; |
|
| 185 | }; |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * @return \Closure |
|
| @@ 191-206 (lines=16) @@ | ||
| 188 | /** |
|
| 189 | * @return \Closure |
|
| 190 | */ |
|
| 191 | protected function getOriginalUrlCallback() |
|
| 192 | { |
|
| 193 | return function (Crawler $crawler) { |
|
| 194 | if ($selector = $this->getOriginalUrlSelector()) { |
|
| 195 | if (preg_match('/^\/\//', $selector)) { |
|
| 196 | $node = $crawler->filterXPath($selector); |
|
| 197 | } else { |
|
| 198 | $node = $crawler->filter($selector); |
|
| 199 | } |
|
| 200 | ||
| 201 | return $node->html(); |
|
| 202 | } |
|
| 203 | ||
| 204 | return null; |
|
| 205 | }; |
|
| 206 | } |
|
| 207 | ||
| 208 | /** |
|
| 209 | * @return \Closure |
|
| @@ 211-228 (lines=18) @@ | ||
| 208 | /** |
|
| 209 | * @return \Closure |
|
| 210 | */ |
|
| 211 | protected function getModificationDateCallback() |
|
| 212 | { |
|
| 213 | return function (Crawler $crawler) { |
|
| 214 | if ($selector = $this->getModificationDateSelector()) { |
|
| 215 | if (preg_match('/^\/\//', $selector)) { |
|
| 216 | $node = $crawler->filterXPath($selector); |
|
| 217 | } else { |
|
| 218 | $node = $crawler->filter($selector); |
|
| 219 | } |
|
| 220 | ||
| 221 | if ($date = $node->html()) { |
|
| 222 | return new \DateTime($date); |
|
| 223 | } |
|
| 224 | } |
|
| 225 | ||
| 226 | return null; |
|
| 227 | }; |
|
| 228 | } |
|
| 229 | ||
| 230 | /** |
|
| 231 | * Override this method to add custom modifiers to the feed. |
|