| @@ -30,20 +30,20 @@ discard block | ||
| 30 | 30 | // protected static $cart_url = 'https://yourdomain.foxycart.com/cart'; | 
| 31 | 31 | protected static $cart_url; | 
| 32 | 32 | |
| 33 | -	public static function setCartURL($storeName = null){ | |
| 33 | +	public static function setCartURL($storeName = null) { | |
| 34 | 34 | self::$cart_url = 'https://'.$storeName.'.faxycart.com/cart'; | 
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | -	public static function setSecret($secret = null){ | |
| 37 | +	public static function setSecret($secret = null) { | |
| 38 | 38 | self::$secret = $secret; | 
| 39 | 39 | } | 
| 40 | 40 | |
| 41 | -	public function __construct(){ | |
| 41 | +	public function __construct() { | |
| 42 | 42 | self::setCartURL(FoxyCart::getFoxyCartStoreName()); | 
| 43 | 43 | self::setSecret(FoxyCart::getStoreKey()); | 
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | -	public static function getSecret(){ | |
| 46 | +	public static function getSecret() { | |
| 47 | 47 | return FoxyCart::getStoreKey(); | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | $codes[$pair['prefix']] = $pair['value']; | 
| 108 | 108 | } | 
| 109 | 109 | } | 
| 110 | -		if ( ! count($codes)) { | |
| 110 | +		if (!count($codes)) { | |
| 111 | 111 | self::$log[] = '<strong style="color:#600;">No code found</strong> for the above link.'; | 
| 112 | 112 | return $fail; | 
| 113 | 113 | } | 
| @@ -131,7 +131,7 @@ discard block | ||
| 131 | 131 | |
| 132 | 132 |  		if ($output) { | 
| 133 | 133 | echo self::$cart_url.'?'.$qs; | 
| 134 | -		} else { | |
| 134 | +		}else { | |
| 135 | 135 | return self::$cart_url.'?'.$qs; | 
| 136 | 136 | } | 
| 137 | 137 | } | 
| @@ -149,18 +149,18 @@ discard block | ||
| 149 | 149 |  		if ($option_value == '--OPEN--') { | 
| 150 | 150 |  			$hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret()); | 
| 151 | 151 | $value = ($urlencode) ? urlencode($option_name).'||'.$hash.'||open' : $option_name.'||'.$hash.'||open'; | 
| 152 | -		} else { | |
| 152 | +		}else { | |
| 153 | 153 |  			$hash = hash_hmac('sha256', $product_code.$option_name.$option_value, self::getSecret()); | 
| 154 | 154 |  			if ($method == 'name') { | 
| 155 | 155 | $value = ($urlencode) ? urlencode($option_name).'||'.$hash : $option_name.'||'.$hash; | 
| 156 | -			} else { | |
| 156 | +			}else { | |
| 157 | 157 | $value = ($urlencode) ? urlencode($option_value).'||'.$hash : $option_value.'||'.$hash; | 
| 158 | 158 | } | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | 161 |  		if ($output) { | 
| 162 | 162 | echo $value; | 
| 163 | -		} else { | |
| 163 | +		}else { | |
| 164 | 164 | return $value; | 
| 165 | 165 | } | 
| 166 | 166 | } | 
| @@ -248,7 +248,7 @@ discard block | ||
| 248 | 248 | $value[2] = ($value[2] == '') ? '--OPEN--' : $value[2]; | 
| 249 | 249 |  						if ($type[2] == 'radio') { | 
| 250 | 250 |  							$input_signed = preg_replace('%([\'"])'.preg_quote($value[2]).'\1%', '${1}'.self::fc_hash_value($code, $name[2], $value[2], 'value', FALSE)."$1", $input); | 
| 251 | -						} else { | |
| 251 | +						}else { | |
| 252 | 252 |  							$input_signed = preg_replace('%([\'"])'.$prefix.preg_quote($name[2]).'\1%', '${1}'.$prefix.self::fc_hash_value($code, $name[2], $value[2], 'name', FALSE)."$1", $input); | 
| 253 | 253 | } | 
| 254 | 254 | self::$log[] = '<strong>INPUT:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). | 
| @@ -267,14 +267,14 @@ discard block | ||
| 267 | 267 | $count['lists']++; | 
| 268 | 268 |  					preg_match_all('%<option [^>]*value=([\'"])(.+?)\1[^>]*>(?:.*?)</option>%i', $list[0], $options, PREG_SET_ORDER); | 
| 269 | 269 | self::$log[] = '<strong>Options:</strong> <pre>'.htmlspecialchars(print_r($options, true)).'</pre>'; | 
| 270 | - unset( $form_part_signed ); | |
| 270 | + unset($form_part_signed); | |
| 271 | 271 |  					foreach ($options as $option) { | 
| 272 | - if( !isset($form_part_signed) ) $form_part_signed = $list[0]; | |
| 272 | + if (!isset($form_part_signed)) $form_part_signed = $list[0]; | |
| 273 | 273 | $option_signed = preg_replace( | 
| 274 | 274 | '%'.preg_quote($option[1]).preg_quote($option[2]).preg_quote($option[1]).'%', | 
| 275 | 275 | $option[1].self::fc_hash_value($code, $list[2], $option[2], 'value', FALSE).$option[1], | 
| 276 | 276 | $option[0]); | 
| 277 | - $form_part_signed = str_replace($option[0], $option_signed, $form_part_signed ); | |
| 277 | + $form_part_signed = str_replace($option[0], $option_signed, $form_part_signed); | |
| 278 | 278 | self::$log[] = '<strong>OPTION:</strong> Code: <strong>'.htmlspecialchars($prefix.$code). | 
| 279 | 279 | '</strong> :: Name: <strong>'.htmlspecialchars($prefix.$list[2]). | 
| 280 | 280 | '</strong> :: Value: <strong>'.htmlspecialchars($option[2]). | 
| @@ -9,43 +9,43 @@ discard block | ||
| 9 | 9 | |
| 10 | 10 | private static $keyPrefix = 'dYnm1c'; | 
| 11 | 11 | |
| 12 | -	public static function setStoreKey($length = 54, $count = 0){ | |
| 12 | +	public static function setStoreKey($length = 54, $count = 0) { | |
| 13 | 13 |  		$charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.strtotime('now'); | 
| 14 | 14 | $strLength = strlen($charset); | 
| 15 | 15 | $str = ''; | 
| 16 | -		while($count < $length){ | |
| 17 | - $str .= $charset[mt_rand(0, $strLength-1)]; | |
| 16 | +		while ($count < $length) { | |
| 17 | + $str .= $charset[mt_rand(0, $strLength - 1)]; | |
| 18 | 18 | $count++; | 
| 19 | 19 | } | 
| 20 | - return self::getKeyPrefix().substr(base64_encode($str),0,$length); | |
| 20 | + return self::getKeyPrefix().substr(base64_encode($str), 0, $length); | |
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | -	public static function getStoreKey(){ | |
| 23 | +	public static function getStoreKey() { | |
| 24 | 24 | $config = SiteConfig::current_site_config(); | 
| 25 | -		if($config->StoreKey){ | |
| 25 | +		if ($config->StoreKey) { | |
| 26 | 26 | return $config->StoreKey; | 
| 27 | 27 | } | 
| 28 | 28 | return null; | 
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | -	public static function store_name_warning(){ | |
| 31 | +	public static function store_name_warning() { | |
| 32 | 32 | $warning = null; | 
| 33 | -		if(self::getFoxyCartStoreName()===null){ | |
| 33 | +		if (self::getFoxyCartStoreName() === null) { | |
| 34 | 34 | $warning = 'Must define FoxyCart Store Name in your site settings in the cms'; | 
| 35 | 35 | } | 
| 36 | 36 | return $warning; | 
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | -	public static function getFoxyCartStoreName(){ | |
| 39 | +	public static function getFoxyCartStoreName() { | |
| 40 | 40 | $config = SiteConfig::current_site_config(); | 
| 41 | -		if($config->StoreName){ | |
| 41 | +		if ($config->StoreName) { | |
| 42 | 42 | return $config->StoreName; | 
| 43 | 43 | } | 
| 44 | 44 | return null; | 
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | 47 |  	public static function FormActionURL() { | 
| 48 | -		return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName() ); | |
| 48 | +		return sprintf('https://%s.foxycart.com/cart', self::getFoxyCartStoreName()); | |
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | 51 | /** | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | $foxyData["api_token"] = FoxyCart::getStoreKey(); | 
| 60 | 60 | |
| 61 | 61 | $ch = curl_init(); | 
| 62 | - curl_setopt($ch, CURLOPT_URL, "https://" . $foxy_domain . "/api"); | |
| 62 | + curl_setopt($ch, CURLOPT_URL, "https://".$foxy_domain."/api"); | |
| 63 | 63 | curl_setopt($ch, CURLOPT_POSTFIELDS, $foxyData); | 
| 64 | 64 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | 
| 65 | 65 | curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | // The following if block will print any CURL errors you might have | 
| 72 | 72 |          if ($response == false) { | 
| 73 | 73 |              //trigger_error("Could not connect to FoxyCart API", E_USER_ERROR); | 
| 74 | -            SS_Log::log("Could not connect to FoxyCart API: " . $response, SS_Log::ERR); | |
| 74 | +            SS_Log::log("Could not connect to FoxyCart API: ".$response, SS_Log::ERR); | |
| 75 | 75 | } | 
| 76 | 76 | curl_close($ch); | 
| 77 | 77 | |
| @@ -96,7 +96,7 @@ discard block | ||
| 96 | 96 | |
| 97 | 97 |      public static function putCustomer($Member = null) { | 
| 98 | 98 | // throw error if no $Member Object | 
| 99 | -        if (!isset($Member)) ;//trigger_error('No Member set', E_USER_ERROR); | |
| 99 | +        if (!isset($Member)); //trigger_error('No Member set', E_USER_ERROR); | |
| 100 | 100 | |
| 101 | 101 | // send updated customer record from API | 
| 102 | 102 | $foxyData = array(); | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | return self::getAPIRequest($foxyData); | 
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | -	public static function getKeyPrefix(){ | |
| 115 | +	public static function getKeyPrefix() { | |
| 116 | 116 | return self::$keyPrefix; | 
| 117 | 117 | } | 
| 118 | 118 | |
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | * | 
| 6 | 6 | */ | 
| 7 | 7 | |
| 8 | -class ProductImage extends DataObject{ | |
| 8 | +class ProductImage extends DataObject { | |
| 9 | 9 | |
| 10 | 10 | private static $db = array( | 
| 11 | 11 | 'Title' => 'Text', | 
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 | 'Title' => 'Caption' | 
| 25 | 25 | ); | 
| 26 | 26 | |
| 27 | -	public function getCMSFields(){ | |
| 27 | +	public function getCMSFields() { | |
| 28 | 28 | $fields = FieldList::create( | 
| 29 | 29 |              TextField::create('Title') | 
| 30 | 30 |                  ->setTitle(_t('ProductImage.Title', 'Product Image Title')), | 
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | * | 
| 6 | 6 | */ | 
| 7 | 7 | |
| 8 | -class OptionGroup extends DataObject{ | |
| 8 | +class OptionGroup extends DataObject { | |
| 9 | 9 | |
| 10 | 10 | private static $db = array( | 
| 11 | 11 | 'Title' => 'Varchar(100)' | 
| @@ -15,7 +15,7 @@ discard block | ||
| 15 | 15 | private static $plural_name = 'Product Option Groups'; | 
| 16 | 16 | private static $description = 'Groups of product options, e.g. size, color, etc'; | 
| 17 | 17 | |
| 18 | -	function getCMSFields(){ | |
| 18 | +	function getCMSFields() { | |
| 19 | 19 | |
| 20 | 20 | $fields = parent::getCMSFields(); | 
| 21 | 21 | |
| @@ -27,22 +27,22 @@ discard block | ||
| 27 | 27 |  	public function requireDefaultRecords() { | 
| 28 | 28 | parent::requireDefaultRecords(); | 
| 29 | 29 | // create a catch-all group | 
| 30 | -		if(!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) { | |
| 30 | +		if (!OptionGroup::get()->filter(array('Title' => 'Options'))->first()) { | |
| 31 | 31 | $do = new OptionGroup(); | 
| 32 | 32 | $do->Title = "Options"; | 
| 33 | 33 | $do->write(); | 
| 34 | 34 | } | 
| 35 | -		if(!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) { | |
| 35 | +		if (!OptionGroup::get()->filter(array('Title' => 'Size'))->first()) { | |
| 36 | 36 | $do = new OptionGroup(); | 
| 37 | 37 | $do->Title = "Size"; | 
| 38 | 38 | $do->write(); | 
| 39 | 39 | } | 
| 40 | -        if(!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) { | |
| 40 | +        if (!OptionGroup::get()->filter(array('Title' => 'Color'))->first()) { | |
| 41 | 41 | $do = new OptionGroup(); | 
| 42 | 42 | $do->Title = "Color"; | 
| 43 | 43 | $do->write(); | 
| 44 | 44 | } | 
| 45 | -        if(!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) { | |
| 45 | +        if (!OptionGroup::get()->filter(array('Title' => 'Type'))->first()) { | |
| 46 | 46 | $do = new OptionGroup(); | 
| 47 | 47 | $do->Title = "Type"; | 
| 48 | 48 | $do->write(); | 
| @@ -53,30 +53,30 @@ discard block | ||
| 53 | 53 |  		return new RequiredFields(array('Title')); | 
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | -	public function validate(){ | |
| 56 | +	public function validate() { | |
| 57 | 57 | $result = parent::validate(); | 
| 58 | 58 | |
| 59 | 59 | $title = $this->Title; | 
| 60 | 60 | $firstChar = substr($title, 0, 1); | 
| 61 | -		if(preg_match('/[^a-zA-Z]/', $firstChar)){ | |
| 61 | +		if (preg_match('/[^a-zA-Z]/', $firstChar)) { | |
| 62 | 62 |  			$result->error('The first character of the Title can only be a letter', 'bad'); | 
| 63 | 63 | } | 
| 64 | -		if(preg_match('/[^a-zA-Z]\s/', $title)){ | |
| 64 | +		if (preg_match('/[^a-zA-Z]\s/', $title)) { | |
| 65 | 65 |  			$result->error('Please only use letters, numbers and spaces in the title', 'bad'); | 
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | return $result; | 
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | -	public function onBeforeDelete(){ | |
| 71 | +	public function onBeforeDelete() { | |
| 72 | 72 | parent::onBeforeDelete(); | 
| 73 | 73 | |
| 74 | 74 | //make sure that if we delete this option group, we reassign the group's option items to the 'None' group. | 
| 75 | 75 |  		$items = OptionItem::get()->filter(array('ProductOptionGroupID' => $this->ID)); | 
| 76 | 76 | |
| 77 | -		if(isset($items)){ | |
| 77 | +		if (isset($items)) { | |
| 78 | 78 |  			$noneGroup = OptionGroup::get()->filter(array('Title' => 'Options'))->first(); | 
| 79 | -			foreach($items as $item){ | |
| 79 | +			foreach ($items as $item) { | |
| 80 | 80 | $item->ProductOptionGroupID = $noneGroup->ID; | 
| 81 | 81 | $item->write(); | 
| 82 | 82 | } | 
| @@ -88,7 +88,7 @@ discard block | ||
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 |  	public function canEdit($member = null) { | 
| 91 | -		switch($this->Title){ | |
| 91 | +		switch ($this->Title) { | |
| 92 | 92 | case 'Options': | 
| 93 | 93 | return false; | 
| 94 | 94 | break; | 
| @@ -11,7 +11,7 @@ discard block | ||
| 11 | 11 | private static $plural_name = 'Order History Pages'; | 
| 12 | 12 | private static $description = 'Show a customers past orders. Requires authentication'; | 
| 13 | 13 | |
| 14 | -	public function getCMSFields(){ | |
| 14 | +	public function getCMSFields() { | |
| 15 | 15 | $fields = parent::getCMSFields(); | 
| 16 | 16 | |
| 17 | 17 | |
| @@ -41,10 +41,10 @@ discard block | ||
| 41 | 41 | ); | 
| 42 | 42 | |
| 43 | 43 |      public function checkMember() { | 
| 44 | -        if(Member::currentUser()) { | |
| 44 | +        if (Member::currentUser()) { | |
| 45 | 45 | return true; | 
| 46 | -        } else { | |
| 47 | - return Security::permissionFailure ($this, _t ( | |
| 46 | +        }else { | |
| 47 | + return Security::permissionFailure($this, _t( | |
| 48 | 48 | 'AccountPage.CANNOTCONFIRMLOGGEDIN', | 
| 49 | 49 | 'Please login to view this page.' | 
| 50 | 50 | )); | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | * @package forms | 
| 49 | 49 | * @subpackage fields-basic | 
| 50 | 50 | */ | 
| 51 | -class FoxyStripeDropdownField extends DropdownField{ | |
| 51 | +class FoxyStripeDropdownField extends DropdownField { | |
| 52 | 52 | |
| 53 | 53 | /** | 
| 54 | 54 | * Mark certain elements as disabled, | 
| @@ -56,12 +56,12 @@ discard block | ||
| 56 | 56 | * | 
| 57 | 57 | * @param array $items Collection of array keys, as defined in the $source array | 
| 58 | 58 | */ | 
| 59 | -	public function setDisabledItems($items){ | |
| 59 | +	public function setDisabledItems($items) { | |
| 60 | 60 | $controller = Controller::curr(); | 
| 61 | 61 | $code = $controller->data()->Code; | 
| 62 | 62 | $updated = []; | 
| 63 | -		if(is_array($items) && !empty($items)){ | |
| 64 | -			foreach($items as $item){ | |
| 63 | +		if (is_array($items) && !empty($items)) { | |
| 64 | +			foreach ($items as $item) { | |
| 65 | 65 | array_push($updated, ProductPage::getGeneratedValue($code, $this->getName(), $item, 'value')); | 
| 66 | 66 | } | 
| 67 | 67 | } | 
| @@ -76,8 +76,8 @@ discard block | ||
| 76 | 76 | $controller = Controller::curr(); | 
| 77 | 77 | $code = $controller->data()->Code; | 
| 78 | 78 | $updated = []; | 
| 79 | -		if(is_array($source) && !empty($source)){ | |
| 80 | -			foreach($source as $key => $val){ | |
| 79 | +		if (is_array($source) && !empty($source)) { | |
| 80 | +			foreach ($source as $key => $val) { | |
| 81 | 81 | $updated[ProductPage::getGeneratedValue($code, $this->getName(), $key, 'value')] = $val; | 
| 82 | 82 | } | 
| 83 | 83 | } | 
| @@ -1,10 +1,10 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -class StoreSettingsTest extends FS_Test{ | |
| 3 | +class StoreSettingsTest extends FS_Test { | |
| 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 | $siteConf = SiteConfig::current_site_config(); | 
| @@ -13,7 +13,7 @@ discard block | ||
| 13 | 13 | $siteConf->write(); | 
| 14 | 14 | } | 
| 15 | 15 | |
| 16 | -	function testStoreKey(){ | |
| 16 | +	function testStoreKey() { | |
| 17 | 17 | $pref = FoxyCart::getKeyPrefix(); | 
| 18 | 18 | $siteConf = SiteConfig::current_site_config(); | 
| 19 | 19 | |
| @@ -22,7 +22,7 @@ discard block | ||
| 22 | 22 | $this->assertEquals(substr($siteConf->StoreKey, 0, 6), $pref); | 
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | -	function testStoreName(){ | |
| 25 | +	function testStoreName() { | |
| 26 | 26 | $siteConf = SiteConfig::current_site_config(); | 
| 27 | 27 | |
| 28 | 28 | $this->assertEquals($siteConf->StoreName, 'foxystripe'); | 
| @@ -1,10 +1,10 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -class ProductPageTest extends FS_Test{ | |
| 3 | +class ProductPageTest extends FS_Test { | |
| 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 | $groupForItem = OptionGroup::create(); | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | $productHolder->write(); | 
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | -	function testProductCreation(){ | |
| 19 | +	function testProductCreation() { | |
| 20 | 20 | |
| 21 | 21 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 22 | 22 |  		$default = $this->objFromFixture('ProductCategory', 'default'); | 
| @@ -29,7 +29,7 @@ discard block | ||
| 29 | 29 | |
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | -	function testProductDeletion(){ | |
| 32 | +	function testProductDeletion() { | |
| 33 | 33 | |
| 34 | 34 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 35 | 35 |  		$product2 = $this->objFromFixture('ProductPage', 'product2'); | 
| @@ -39,22 +39,22 @@ discard block | ||
| 39 | 39 | $product2->doPublish(); | 
| 40 | 40 | $this->assertTrue($product2->isPublished()); | 
| 41 | 41 | |
| 42 | -		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); | |
| 42 | +		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); | |
| 43 | 43 | $versionsPostPublish = array(); | 
| 44 | - foreach($versions as $versionRow) $versionsPostPublish[] = $versionRow; | |
| 44 | + foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow; | |
| 45 | 45 | |
| 46 | 46 | $product2->delete(); | 
| 47 | 47 | $this->assertTrue(!$product2->isPublished()); | 
| 48 | 48 | |
| 49 | -		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '. $productID); | |
| 49 | +		$versions = DB::query('Select * FROM "ProductPage_versions" WHERE "RecordID" = '.$productID); | |
| 50 | 50 | $versionsPostDelete = array(); | 
| 51 | - foreach($versions as $versionRow) $versionsPostDelete[] = $versionRow; | |
| 51 | + foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow; | |
| 52 | 52 | |
| 53 | 53 | $this->assertTrue($versionsPostPublish == $versionsPostDelete); | 
| 54 | 54 | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | -	function testProductTitleLeadingWhiteSpace(){ | |
| 57 | +	function testProductTitleLeadingWhiteSpace() { | |
| 58 | 58 | |
| 59 | 59 |  		$this->logInWithPermission('ADMIN'); | 
| 60 | 60 |  		$product = $this->objFromFixture('ProductPage', 'product1'); | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -	function testProductTitleTrailingWhiteSpace(){ | |
| 69 | +	function testProductTitleTrailingWhiteSpace() { | |
| 70 | 70 | |
| 71 | 71 |  		$this->logInWithPermission('ADMIN'); | 
| 72 | 72 |  		$product = $this->objFromFixture('ProductPage', 'product1'); | 
| @@ -78,7 +78,7 @@ discard block | ||
| 78 | 78 | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | -	function testProductCategoryCreation(){ | |
| 81 | +	function testProductCategoryCreation() { | |
| 82 | 82 | |
| 83 | 83 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 84 | 84 |  		$category = $this->objFromFixture('ProductCategory', 'apparel'); | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | |
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | -	function testProductCategoryDeletion(){ | |
| 94 | +	function testProductCategoryDeletion() { | |
| 95 | 95 | |
| 96 | 96 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 97 | 97 |  		$category = $this->objFromFixture('ProductCategory', 'default'); | 
| @@ -117,11 +117,11 @@ discard block | ||
| 117 | 117 | |
| 118 | 118 | $category2->delete(); | 
| 119 | 119 | |
| 120 | -		$this->assertFalse(in_array($category2ID,ProductCategory::get()->column('ID'))); | |
| 120 | +		$this->assertFalse(in_array($category2ID, ProductCategory::get()->column('ID'))); | |
| 121 | 121 | |
| 122 | 122 | } | 
| 123 | 123 | |
| 124 | -	function testOptionGroupCreation(){ | |
| 124 | +	function testOptionGroupCreation() { | |
| 125 | 125 | |
| 126 | 126 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 127 | 127 |  		$group = $this->objFromFixture('OptionGroup', 'size'); | 
| @@ -131,7 +131,7 @@ discard block | ||
| 131 | 131 | |
| 132 | 132 | } | 
| 133 | 133 | |
| 134 | -	function testOptionGroupDeletion(){ | |
| 134 | +	function testOptionGroupDeletion() { | |
| 135 | 135 | |
| 136 | 136 |  		$this->logInWithPermission('ADMIN'); | 
| 137 | 137 |  		$group = $this->objFromFixture('OptionGroup', 'color'); | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | |
| 151 | 151 | } | 
| 152 | 152 | |
| 153 | -	function testOptionItemCreation(){ | |
| 153 | +	function testOptionItemCreation() { | |
| 154 | 154 | |
| 155 | 155 |  		$this->logInWithPermission('Product_CANCRUD'); | 
| 156 | 156 |  		$optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first(); | 
| @@ -165,13 +165,13 @@ discard block | ||
| 165 | 165 | |
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | -	function testOptionItemDeletion(){ | |
| 168 | +	function testOptionItemDeletion() { | |
| 169 | 169 | |
| 170 | 170 |  		$this->logInWithPermission('ADMIN'); | 
| 171 | 171 | $optionGroup = (OptionGroup::get()->first()) | 
| 172 | 172 | ? OptionGroup::get()->first() | 
| 173 | 173 | : OptionGroup::create(); | 
| 174 | -		if($optionGroup->ID == 0){ | |
| 174 | +		if ($optionGroup->ID == 0) { | |
| 175 | 175 | $optionGroup->Title = 'Size'; | 
| 176 | 176 | $optionGroup->write(); | 
| 177 | 177 | } | 
| @@ -1,12 +1,12 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -class FS_Test extends FunctionalTest{ | |
| 3 | +class FS_Test extends FunctionalTest { | |
| 4 | 4 | |
| 5 | 5 | protected static $fixture_file = 'foxystripe/tests/FoxyStripeTest.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,10 +14,10 @@ discard block | ||
| 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 | } | 
| 20 | 20 | |
| 21 | -    public function testProductPage(){} | |
| 21 | +    public function testProductPage() {} | |
| 22 | 22 | |
| 23 | 23 | } |