Completed
Pull Request — master (#38)
by Jason
02:20
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/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.
code/SlideImage.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -2,95 +2,95 @@
 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
-    {
12
-        $fields = parent::getCMSFields();
13
-        $ImageField = new UploadField('Image', 'Image');
14
-        $ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
15
-        $ImageField->setFolderName('Uploads/SlideImages');
16
-        $ImageField->setConfig('allowedMaxFileNumber', 1);
17
-        $ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
10
+	public function getCMSFields()
11
+	{
12
+		$fields = parent::getCMSFields();
13
+		$ImageField = new UploadField('Image', 'Image');
14
+		$ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
15
+		$ImageField->setFolderName('Uploads/SlideImages');
16
+		$ImageField->setConfig('allowedMaxFileNumber', 1);
17
+		$ImageField->getValidator()->setAllowedMaxFileSize(FLEXSLIDER_IMAGE_FILE_SIZE_LIMIT);
18 18
 
19
-        $fields->removeByName(array('ShowSlide'));
19
+		$fields->removeByName(array('ShowSlide'));
20 20
 
21
-        $fields->addFieldsToTab('Root.Main', array(
22
-            TextField::create('Name')
23
-                ->setDescription('for internal reference only'),
24
-            TextField::create('Title')
25
-                ->setDescription('optional, used in template'),
26
-            TextareaField::create('Description')
27
-                ->setDescription('optional, used in template'),
28
-            TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'),
29
-            $ImageField,
30
-            CheckboxField::create('ShowSlide')->setTitle('Show Slide')
31
-                ->setDescription('Include this slide in the slider. Uncheck to hide'),
32
-        ));
33
-        $fields->removeByName(array(
34
-            'SortOrder',
35
-            'PageID',
36
-        ));
21
+		$fields->addFieldsToTab('Root.Main', array(
22
+			TextField::create('Name')
23
+				->setDescription('for internal reference only'),
24
+			TextField::create('Title')
25
+				->setDescription('optional, used in template'),
26
+			TextareaField::create('Description')
27
+				->setDescription('optional, used in template'),
28
+			TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'),
29
+			$ImageField,
30
+			CheckboxField::create('ShowSlide')->setTitle('Show Slide')
31
+				->setDescription('Include this slide in the slider. Uncheck to hide'),
32
+		));
33
+		$fields->removeByName(array(
34
+			'SortOrder',
35
+			'PageID',
36
+		));
37 37
 
38
-        $this->extend('updateCMSFields', $fields);
38
+		$this->extend('updateCMSFields', $fields);
39 39
 
40
-        return $fields;
41
-    }
40
+		return $fields;
41
+	}
42 42
 
43
-    public function validate()
44
-    {
45
-        $result = parent::validate();
43
+	public function validate()
44
+	{
45
+		$result = parent::validate();
46 46
 
47
-        if (!$this->Name) {
48
-            $result->error('A Name is required before you can save');
49
-        }
47
+		if (!$this->Name) {
48
+			$result->error('A Name is required before you can save');
49
+		}
50 50
 
51
-        if (!$this->ImageID) {
52
-            $result->error('An Image is required before you can save');
53
-        }
51
+		if (!$this->ImageID) {
52
+			$result->error('An Image is required before you can save');
53
+		}
54 54
 
55
-        return $result;
56
-    }
55
+		return $result;
56
+	}
57 57
 
58
-    public function Thumbnail()
59
-    {
60
-        return $this->Image()->CroppedImage(80, 80);
61
-    }
58
+	public function Thumbnail()
59
+	{
60
+		return $this->Image()->CroppedImage(80, 80);
61
+	}
62 62
 
63
-    public function Large()
64
-    {
65
-        if ($this->Image()->GetHeight() > 700) {
66
-            return $this->Image()->SetHeight(700);
67
-        } else {
68
-            return $this->Image();
69
-        }
70
-    }
63
+	public function Large()
64
+	{
65
+		if ($this->Image()->GetHeight() > 700) {
66
+			return $this->Image()->SetHeight(700);
67
+		} else {
68
+			return $this->Image();
69
+		}
70
+	}
71 71
 
72
-    public function providePermissions()
73
-    {
74
-        return array(
75
-            'Slide_EDIT' => 'Edit a Slide',
76
-            'Slide_DELETE' => 'Delete a Slide',
77
-            'Slide_CREATE' => 'Create a Slide',
78
-        );
79
-    }
80
-    public function canCreate($member = null)
81
-    {
82
-        return Permission::check('Slide_CREATE');
83
-    }
84
-    public function canEdit($member = null)
85
-    {
86
-        return Permission::check('Slide_EDIT');
87
-    }
88
-    public function canDelete($member = null)
89
-    {
90
-        return Permission::check('Slide_DELETE');
91
-    }
92
-    public function canView($member = null)
93
-    {
94
-        return true;
95
-    }
72
+	public function providePermissions()
73
+	{
74
+		return array(
75
+			'Slide_EDIT' => 'Edit a Slide',
76
+			'Slide_DELETE' => 'Delete a Slide',
77
+			'Slide_CREATE' => 'Create a Slide',
78
+		);
79
+	}
80
+	public function canCreate($member = null)
81
+	{
82
+		return Permission::check('Slide_CREATE');
83
+	}
84
+	public function canEdit($member = null)
85
+	{
86
+		return Permission::check('Slide_EDIT');
87
+	}
88
+	public function canDelete($member = null)
89
+	{
90
+		return Permission::check('Slide_DELETE');
91
+	}
92
+	public function canView($member = null)
93
+	{
94
+		return true;
95
+	}
96 96
 }
Please login to merge, or discard this patch.