Merge branch '3.4' into 3

This commit is contained in:
Daniel Hensby 2016-05-20 12:35:58 +01:00
commit e6f9e3a370
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
4 changed files with 12 additions and 9 deletions

View File

@ -149,7 +149,7 @@ class RSSFeed extends ViewableData {
if(isset($this->entries)) { if(isset($this->entries)) {
foreach($this->entries as $entry) { foreach($this->entries as $entry) {
$output->push( $output->push(
new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); RSSFeed_Entry::create($entry, $this->titleField, $this->descriptionField, $this->authorField));
} }
} }
return $output; return $output;
@ -184,7 +184,11 @@ class RSSFeed extends ViewableData {
} }
/** /**
* Output the feed to the browser * Output the feed to the browser.
*
* TODO: Pass $response object to ->outputToBrowser() to loosen dependence on global state for easier testing/prototyping so dev can inject custom SS_HTTPResponse instance.
*
* @return HTMLText
*/ */
public function outputToBrowser() { public function outputToBrowser() {
$prevState = Config::inst()->get('SSViewer', 'source_file_comments'); $prevState = Config::inst()->get('SSViewer', 'source_file_comments');

View File

@ -493,8 +493,7 @@ class SS_ClassManifest {
// files will have changed and TokenisedRegularExpression is quite // files will have changed and TokenisedRegularExpression is quite
// slow. A combination of the file name and file contents hash are used, // slow. A combination of the file name and file contents hash are used,
// since just using the datetime lead to problems with upgrading. // since just using the datetime lead to problems with upgrading.
$file = file_get_contents($pathname); $key = preg_replace('/[^a-zA-Z0-9_]/', '_', $basename) . '_' . md5_file($pathname);
$key = preg_replace('/[^a-zA-Z0-9_]/', '_', $basename) . '_' . md5($file);
if ($data = $this->cache->load($key)) { if ($data = $this->cache->load($key)) {
$valid = ( $valid = (
@ -513,7 +512,7 @@ class SS_ClassManifest {
} }
if (!$classes) { if (!$classes) {
$tokens = token_get_all($file); $tokens = token_get_all(file_get_contents($pathname));
$classes = self::get_namespaced_class_parser()->findAll($tokens); $classes = self::get_namespaced_class_parser()->findAll($tokens);

View File

@ -150,7 +150,7 @@ shortcuts and methods for fetching, sorting and filtering data from our database
$players = Player::get(); $players = Player::get();
// returns a `DataList` containing all the `Player` objects. // returns a `DataList` containing all the `Player` objects.
$player = Player::get()->byId(2); $player = Player::get()->byID(2);
// returns a single `Player` object instance that has the ID of 2. // returns a single `Player` object instance that has the ID of 2.
echo $player->ID; echo $player->ID;

View File

@ -19,13 +19,13 @@ An example of a `SearchFilter` in use:
:::php :::php
// fetch any player that starts with a S // fetch any player that starts with a S
$players = Player::get()->filter(array( $players = Player::get()->filter(array(
'FirstName:StartsWith' => 'S' 'FirstName:StartsWith' => 'S',
'PlayerNumber:GreaterThan' => '10' 'PlayerNumber:GreaterThan' => '10'
)); ));
// to fetch any player that's name contains the letter 'z' // to fetch any player that's name contains the letter 'z'
$players = Player::get()->filterAny(array( $players = Player::get()->filterAny(array(
'FirstName:PartialMatch' => 'z' 'FirstName:PartialMatch' => 'z',
'LastName:PartialMatch' => 'z' 'LastName:PartialMatch' => 'z'
)); ));