Completed
Push — master ( 257050...36ca99 )
by Jason
02:54
created
tests/SlideImageTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class SlideImageTest extends FlexSliderTest{
3
+class SlideImageTest extends FlexSliderTest {
4 4
 
5 5
 	protected static $use_draft_site = true;
6 6
 
7
-	function setUp(){
7
+	function setUp() {
8 8
 		parent::setUp();
9 9
 	}
10 10
 
11
-	function testSlideImageCreation(){
11
+	function testSlideImageCreation() {
12 12
 
13 13
 		$this->logInWithPermission('Slide_CREATE');
14 14
 		$slide = $this->objFromFixture('SlideImage', 'slide1');
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 		$this->assertTrue($slideID > 0);
21 21
 
22 22
 		$getSlide = SlideImage::get()->byID($slideID);
23
-		$this->assertTrue($getSlide->ID == $slideID);
23
+		$this->assertTrue($getSlide->ID==$slideID);
24 24
 
25 25
 	}
26 26
 
27
-	function testSlideUpdate(){
27
+	function testSlideUpdate() {
28 28
 
29 29
 		$this->logInWithPermission('ADMIN');
30 30
 		$slide = $this->objFromFixture('SlideImage', 'slide1');
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 
47 47
 		$slide = SlideImage::get()->byiD($slideID);
48 48
 
49
-		$this->assertTrue($slide->Name == $newTitle);
49
+		$this->assertTrue($slide->Name==$newTitle);
50 50
 
51 51
 	}
52 52
 
53
-	function testSlideImageDeletion(){
53
+	function testSlideImageDeletion() {
54 54
 
55 55
 		$this->logInWithPermission('Slide_DELETE');
56 56
 		$slide = $this->objFromFixture('SlideImage', 'slide2');
Please login to merge, or discard this patch.
tests/FlexSliderTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FlexSliderTest extends FunctionalTest{
3
+class FlexSliderTest extends FunctionalTest {
4 4
 
5 5
 	protected static $fixture_file = 'flexslider/tests/FlexSliderTest.yml';
6 6
 	protected static $disable_themes = true;
7 7
 	protected static $use_draft_site = false;
8 8
 
9
-	public function setUp(){
9
+	public function setUp() {
10 10
 		parent::setUp();
11 11
 
12 12
 		ini_set('display_errors', 1);
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 		error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
15 15
 	}
16 16
 
17
-	public function logOut(){
17
+	public function logOut() {
18 18
 		$this->session()->clear('loggedInAs');
19 19
 		$this->session()->clear('logInWithPermission');
20 20
 	}
21 21
 
22
-	public function testFlexSlider(){}
22
+	public function testFlexSlider() {}
23 23
 
24 24
 }
Please login to merge, or discard this patch.
code/SlideImage.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -2,13 +2,13 @@  discard block
 block discarded – undo
2 2
 
3 3
 class SlideImage extends DataObject implements PermissionProvider
4 4
 {
5
-    //TODO: move to config.yml
6
-    private static $defaults = array(
7
-        'ShowSlide' => true,
8
-    );
5
+	//TODO: move to config.yml
6
+	private static $defaults = array(
7
+		'ShowSlide' => true,
8
+	);
9 9
 
10
-    public function getCMSFields()
11
-    {
10
+	public function getCMSFields()
11
+	{
12 12
 		$fields = parent::getCMSFields();
13 13
 		$ImageField = new UploadField('Image', 'Image');
14 14
 		$ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
@@ -33,59 +33,59 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$this->extend('updateCMSFields', $fields);
35 35
 		return $fields;
36
-    }
36
+	}
37 37
 
38
-    public function validate()
39
-    {
40
-        $result = parent::validate();
38
+	public function validate()
39
+	{
40
+		$result = parent::validate();
41 41
 
42
-        if (!$this->Name) {
43
-            $result->error('A Name is required before you can save');
44
-        }
42
+		if (!$this->Name) {
43
+			$result->error('A Name is required before you can save');
44
+		}
45 45
 
46
-        if (!$this->ImageID) {
47
-            $result->error('An Image is required before you can save');
48
-        }
46
+		if (!$this->ImageID) {
47
+			$result->error('An Image is required before you can save');
48
+		}
49 49
 
50
-        return $result;
51
-    }
50
+		return $result;
51
+	}
52 52
 
53
-    public function Thumbnail()
54
-    {
55
-        return $this->Image()->CroppedImage(80, 80);
56
-    }
53
+	public function Thumbnail()
54
+	{
55
+		return $this->Image()->CroppedImage(80, 80);
56
+	}
57 57
 
58
-    public function Large()
59
-    {
60
-        if ($this->Image()->GetHeight() > 700) {
61
-            return $this->Image()->SetHeight(700);
62
-        } else {
63
-            return $this->Image();
64
-        }
65
-    }
58
+	public function Large()
59
+	{
60
+		if ($this->Image()->GetHeight() > 700) {
61
+			return $this->Image()->SetHeight(700);
62
+		} else {
63
+			return $this->Image();
64
+		}
65
+	}
66 66
 
67
-    public function providePermissions()
68
-    {
69
-        return array(
70
-            'Slide_EDIT' => 'Edit a Slide',
71
-            'Slide_DELETE' => 'Delete a Slide',
72
-            'Slide_CREATE' => 'Create a Slide',
73
-        );
74
-    }
75
-    public function canCreate($member = null)
76
-    {
77
-        return Permission::check('Slide_CREATE');
78
-    }
79
-    public function canEdit($member = null)
80
-    {
81
-        return Permission::check('Slide_EDIT');
82
-    }
83
-    public function canDelete($member = null)
84
-    {
85
-        return Permission::check('Slide_DELETE');
86
-    }
87
-    public function canView($member = null)
88
-    {
89
-        return true;
90
-    }
67
+	public function providePermissions()
68
+	{
69
+		return array(
70
+			'Slide_EDIT' => 'Edit a Slide',
71
+			'Slide_DELETE' => 'Delete a Slide',
72
+			'Slide_CREATE' => 'Create a Slide',
73
+		);
74
+	}
75
+	public function canCreate($member = null)
76
+	{
77
+		return Permission::check('Slide_CREATE');
78
+	}
79
+	public function canEdit($member = null)
80
+	{
81
+		return Permission::check('Slide_EDIT');
82
+	}
83
+	public function canDelete($member = null)
84
+	{
85
+		return Permission::check('Slide_DELETE');
86
+	}
87
+	public function canView($member = null)
88
+	{
89
+		return true;
90
+	}
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
code/FlexSlider.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -2,55 +2,55 @@
 block discarded – undo
2 2
 
3 3
 class FlexSlider extends DataExtension
4 4
 {
5
-    public static $db = array(
6
-        'Animation' => "Enum('slide, fade', 'slide')",
7
-        'Loop' => 'Boolean',
8
-        'Animate' => 'Boolean',
9
-        'ThumbnailNav' => 'Boolean',
10
-    );
5
+	public static $db = array(
6
+		'Animation' => "Enum('slide, fade', 'slide')",
7
+		'Loop' => 'Boolean',
8
+		'Animate' => 'Boolean',
9
+		'ThumbnailNav' => 'Boolean',
10
+	);
11 11
 
12
-    public static $has_many = array(
13
-        'Slides' => 'SlideImage',
14
-    );
12
+	public static $has_many = array(
13
+		'Slides' => 'SlideImage',
14
+	);
15 15
 
16
-    public static $defaults = array(
17
-        'Loop' => '1',
18
-        'Animate' => '1',
19
-    );
16
+	public static $defaults = array(
17
+		'Loop' => '1',
18
+		'Animate' => '1',
19
+	);
20 20
 
21
-    public function populateDefaults()
22
-    {
23
-        parent::populateDefaults();
24
-        $this->Loop = 1;
25
-        $this->Animate = 1;
26
-    }
21
+	public function populateDefaults()
22
+	{
23
+		parent::populateDefaults();
24
+		$this->Loop = 1;
25
+		$this->Animate = 1;
26
+	}
27 27
 
28
-    public function updateCMSFields(FieldList $fields)
29
-    {
30
-        // Slides
31
-        $config = GridFieldConfig_RecordEditor::create();
32
-        if (class_exists('GridFieldSortableRows')) {
33
-            $config->addComponent(new GridFieldSortableRows('SortOrder'));
34
-        }
35
-        $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
36
-        $config->removeComponentsByType('GridFieldDeleteAction');
37
-        $config->addComponent(new GridFieldDeleteAction(false));
38
-        $SlidesField = GridField::create('Slides', 'Slides', $this->owner->Slides()->sort('SortOrder'), $config);
28
+	public function updateCMSFields(FieldList $fields)
29
+	{
30
+		// Slides
31
+		$config = GridFieldConfig_RecordEditor::create();
32
+		if (class_exists('GridFieldSortableRows')) {
33
+			$config->addComponent(new GridFieldSortableRows('SortOrder'));
34
+		}
35
+		$config->removeComponentsByType('GridFieldAddExistingAutocompleter');
36
+		$config->removeComponentsByType('GridFieldDeleteAction');
37
+		$config->addComponent(new GridFieldDeleteAction(false));
38
+		$SlidesField = GridField::create('Slides', 'Slides', $this->owner->Slides()->sort('SortOrder'), $config);
39 39
 
40
-        $fields->addFieldsToTab('Root.Slides', array(
41
-            HeaderField::create('SliderHD', 'Slides', 3),
42
-            $SlidesField,
43
-            ToggleCompositeField::create('ConfigHD', 'Slider Settings', array(
44
-                CheckboxField::create('Animate', 'Animate automatically'),
45
-                DropdownField::create('Animation', 'Animation option', $this->owner->dbObject('Animation')->enumValues()),
46
-                CheckboxField::create('Loop', 'Loop the carousel'),
47
-                CheckboxField::create('ThumbnailNav', 'Thumbnail Navigation'),
48
-            )),
49
-        ));
50
-    }
40
+		$fields->addFieldsToTab('Root.Slides', array(
41
+			HeaderField::create('SliderHD', 'Slides', 3),
42
+			$SlidesField,
43
+			ToggleCompositeField::create('ConfigHD', 'Slider Settings', array(
44
+				CheckboxField::create('Animate', 'Animate automatically'),
45
+				DropdownField::create('Animation', 'Animation option', $this->owner->dbObject('Animation')->enumValues()),
46
+				CheckboxField::create('Loop', 'Loop the carousel'),
47
+				CheckboxField::create('ThumbnailNav', 'Thumbnail Navigation'),
48
+			)),
49
+		));
50
+	}
51 51
 
52
-    public function SlideShow()
53
-    {
54
-        return $this->owner->Slides()->filter(array('ShowSlide' => 1))->sort('SortOrder');
55
-    }
52
+	public function SlideShow()
53
+	{
54
+		return $this->owner->Slides()->filter(array('ShowSlide' => 1))->sort('SortOrder');
55
+	}
56 56
 }
Please login to merge, or discard this patch.
code/FlexSliderExtension.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 			? $this->owner->setFlexSliderSpeed()
19 19
 			: 7000;
20 20
 
21
-        // only call custom script if page has Slides and DataExtension
22
-        if (Object::has_extension($this->owner->data()->ClassName, 'FlexSlider')) {
23
-            if($this->owner->data()->Slides()->exists()){
24
-                Requirements::customScript("
21
+		// only call custom script if page has Slides and DataExtension
22
+		if (Object::has_extension($this->owner->data()->ClassName, 'FlexSlider')) {
23
+			if($this->owner->data()->Slides()->exists()){
24
+				Requirements::customScript("
25 25
                 (function($) {
26 26
                     $(document).ready(function(){
27 27
                         $('.flexslider').flexslider({
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
                         });
45 45
                     });
46 46
                 }(jQuery));");
47
-            }
48
-        }
47
+			}
48
+		}
49 49
 
50 50
 	}
51 51
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 
21 21
         // only call custom script if page has Slides and DataExtension
22 22
         if (Object::has_extension($this->owner->data()->ClassName, 'FlexSlider')) {
23
-            if($this->owner->data()->Slides()->exists()){
23
+            if ($this->owner->data()->Slides()->exists()) {
24 24
                 Requirements::customScript("
25 25
                 (function($) {
26 26
                     $(document).ready(function(){
27 27
                         $('.flexslider').flexslider({
28
-                            slideshow: " . $animate . ",
29
-                            animation: '" . $this->owner->Animation . "',
30
-                            animationLoop: " . $loop . ",
28
+                            slideshow: " . $animate.",
29
+                            animation: '" . $this->owner->Animation."',
30
+                            animationLoop: " . $loop.",
31 31
                             controlNav: true,
32 32
                             directionNav: true,
33 33
                             prevText: '',
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                             },
41 41
                             before: ".$before.",
42 42
                             after: ".$after.",
43
-                            slideshowSpeed: " . $speed . "
43
+                            slideshowSpeed: " . $speed."
44 44
                         });
45 45
                     });
46 46
                 }(jQuery));");
Please login to merge, or discard this patch.