Skip to content

Commit

Permalink
PSR-2 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jonom committed Feb 15, 2016
1 parent 504b198 commit 0d390fb
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 325 deletions.
8 changes: 4 additions & 4 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

if(!defined('FOCUSPOINT_DIR')) {
//Assumes focus point module is installed in web root
define('FOCUSPOINT_DIR', basename(dirname(__FILE__)));
}
if (!defined('FOCUSPOINT_DIR')) {
//Assumes focus point module is installed in web root
define('FOCUSPOINT_DIR', basename(dirname(__FILE__)));
}
62 changes: 33 additions & 29 deletions code/FPImage.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<?php

class FPImage extends Image {

public function Fill($width, $height) {
return $this->FocusFill($width, $height);
}

public function FillMax($width, $height) {
return $this->FocusFillMax($width, $height);
}

public function CropWidth($width) {
return $this->FocusCropWidth($width);
}

public function CropHeight($height) {
return $this->FocusCropHeight($height);
}
class FPImage extends Image
{
public function Fill($width, $height)
{
return $this->FocusFill($width, $height);
}

public function FillMax($width, $height)
{
return $this->FocusFillMax($width, $height);
}

public function CropWidth($width)
{
return $this->FocusCropWidth($width);
}

public function CropHeight($height)
{
return $this->FocusCropHeight($height);
}
}

/*
Expand All @@ -26,20 +30,20 @@ public function CropHeight($height) {
// e.g. `$Image.ScaleHeight(200).CropWidth(200)` will not use $FocusCropWidth.
class FPImage_cached extends Image_cached {
public function Fill($width, $height) {
return $this->FocusFill($width, $height);
}
public function Fill($width, $height) {
return $this->FocusFill($width, $height);
}
public function FillMax($width, $height) {
return $this->FocusFillMax($width, $height);
}
public function FillMax($width, $height) {
return $this->FocusFillMax($width, $height);
}
public function CropWidth($width) {
return $this->FocusCropWidth($width);
}
public function CropWidth($width) {
return $this->FocusCropWidth($width);
}
public function CropHeight($height) {
return $this->FocusCropHeight($height);
}
public function CropHeight($height) {
return $this->FocusCropHeight($height);
}
}
*/
55 changes: 29 additions & 26 deletions code/FocusPointField.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,37 @@
*
* @extends FieldGroup
*/
class FocusPointField extends FieldGroup {
class FocusPointField extends FieldGroup
{
/**
* Enable to view Focus X and Focus Y fields while in Dev mode.
*
* @var bool
* @config
*/
private static $debug = false;

/**
* Enable to view Focus X and Focus Y fields while in Dev mode
*
* @var boolean
* @config
*/
private static $debug = false;
public function __construct(Image $image)
{
// Load necessary scripts and styles
Requirements::javascript(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR.'/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FOCUSPOINT_DIR.'/javascript/FocusPointField.js');
Requirements::css(FOCUSPOINT_DIR.'/css/FocusPointField.css');

public function __construct(Image $image) {
// Load necessary scripts and styles
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript(FOCUSPOINT_DIR . '/javascript/FocusPointField.js');
Requirements::css(FOCUSPOINT_DIR . '/css/FocusPointField.css');

// Create the fields
// Create the fields
$fields = array(
LiteralField::create('FocusPointGrid', $image->renderWith('FocusPointField')),
TextField::create('FocusX'),
TextField::create('FocusY')
LiteralField::create('FocusPointGrid', $image->renderWith('FocusPointField')),
TextField::create('FocusX'),
TextField::create('FocusY'),
);
$this->setName('FocusPoint');
$this->setTitle('Focus Point');
$this->addExtraClass('focuspoint-fieldgroup');
if (Director::isDev() && $this->config()->get('debug')) $this->addExtraClass('debug');
$this->setName('FocusPoint');
$this->setTitle('Focus Point');
$this->addExtraClass('focuspoint-fieldgroup');
if (Director::isDev() && $this->config()->get('debug')) {
$this->addExtraClass('debug');
}

parent::__construct($fields);
}
}
parent::__construct($fields);
}
}
Loading

0 comments on commit 0d390fb

Please sign in to comment.