@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * @link http://www.php.net/manual/en/class.jsonserializable.php |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if(PHP_VERSION_ID < 50400) |
|
| 13 | +if (PHP_VERSION_ID < 50400) |
|
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | 16 | * JsonSerializable interface |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $this->importSupport = false; |
| 59 | 59 | |
| 60 | 60 | $browserName = $this->getBrowserName(); |
| 61 | - if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 61 | + if ($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 62 | 62 | { |
| 63 | - header( 'Location: /badbrowser.php' ) ; |
|
| 63 | + header('Location: /badbrowser.php'); |
|
| 64 | 64 | } |
| 65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 65 | + else if ($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 66 | 66 | { |
| 67 | 67 | $this->importSupport = true; |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function getBrowscap() |
| 79 | 79 | { |
| 80 | - if(isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 80 | + if (isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 81 | 81 | { |
| 82 | 82 | return new Browscap($GLOBALS['BROWSCAP_CACHE']); |
| 83 | 83 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function getBrowser() |
| 91 | 91 | { |
| 92 | - static $browser;//No accident can arise from depending on an unset variable. |
|
| 93 | - if(!isset($browser)) |
|
| 92 | + static $browser; //No accident can arise from depending on an unset variable. |
|
| 93 | + if (!isset($browser)) |
|
| 94 | 94 | { |
| 95 | 95 | $browser = $this->browscap->getBrowser(); |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | private function getBrowserName() |
| 104 | 104 | { |
| 105 | - if(isset($this->browser->Browser)) |
|
| 105 | + if (isset($this->browser->Browser)) |
|
| 106 | 106 | { |
| 107 | 107 | return $this->browser->Browser; |
| 108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function getBrowserMajorVer() |
| 119 | 119 | { |
| 120 | - if(isset($this->browser->MajorVer)) |
|
| 120 | + if (isset($this->browser->MajorVer)) |
|
| 121 | 121 | { |
| 122 | 122 | return $this->browser->MajorVer; |
| 123 | 123 | } |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return string The tag as a string |
| 192 | 192 | */ |
| 193 | - protected function createOpenTag($tagName, $attribs=array(), $selfClose=false) |
|
| 193 | + protected function createOpenTag($tagName, $attribs = array(), $selfClose = false) |
|
| 194 | 194 | { |
| 195 | 195 | $tag = '<'.$tagName; |
| 196 | 196 | $attribNames = array_keys($attribs); |
| 197 | - foreach($attribNames as $attribName) |
|
| 197 | + foreach ($attribNames as $attribName) |
|
| 198 | 198 | { |
| 199 | - $tag.=' '.$attribName; |
|
| 200 | - if($attribs[$attribName]) |
|
| 199 | + $tag .= ' '.$attribName; |
|
| 200 | + if ($attribs[$attribName]) |
|
| 201 | 201 | { |
| 202 | - $tag.='="'.$attribs[$attribName].'"'; |
|
| 202 | + $tag .= '="'.$attribs[$attribName].'"'; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - if($selfClose) |
|
| 205 | + if ($selfClose) |
|
| 206 | 206 | { |
| 207 | 207 | return $tag.'/>'; |
| 208 | 208 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return string The link |
| 231 | 231 | */ |
| 232 | - public function createLink($linkName, $linkTarget='#') |
|
| 232 | + public function createLink($linkName, $linkTarget = '#') |
|
| 233 | 233 | { |
| 234 | 234 | $startTag = $this->createOpenTag('a', array('href'=>$linkTarget)); |
| 235 | 235 | $endTag = $this->createCloseTag('a'); |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param string $prefix The prefix to append to each line |
| 247 | 247 | */ |
| 248 | - protected function printIeCompatability($prefix='') |
|
| 248 | + protected function printIeCompatability($prefix = '') |
|
| 249 | 249 | { |
| 250 | 250 | //IE 8 doesn't support HTML 5. Install the shim... |
| 251 | - if($this->getBrowserMajorVer() < 9) |
|
| 251 | + if ($this->getBrowserMajorVer() < 9) |
|
| 252 | 252 | { |
| 253 | 253 | echo $prefix.'<script src="js/html5.js"></script>'; |
| 254 | 254 | echo "\n"; |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param string $prefix The prefix to append to each line |
| 265 | 265 | */ |
| 266 | - protected function printHead($prefix='') |
|
| 266 | + protected function printHead($prefix = '') |
|
| 267 | 267 | { |
| 268 | 268 | echo $prefix.'<HEAD>'; |
| 269 | - if($this->getBrowserName() === 'IE') |
|
| 269 | + if ($this->getBrowserName() === 'IE') |
|
| 270 | 270 | { |
| 271 | 271 | $this->printIeCompatability($prefix.$prefix); |
| 272 | 272 | } |
| 273 | 273 | echo $prefix.$prefix.'<TITLE>'.$this->title.'</TITLE>'; |
| 274 | 274 | echo $prefix.$prefix.'<meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
| 275 | - foreach($this->headTags as $tag) |
|
| 275 | + foreach ($this->headTags as $tag) |
|
| 276 | 276 | { |
| 277 | 277 | echo $prefix.$prefix.$tag."\n"; |
| 278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @param string $prefix The prefix to append to each line |
| 286 | 286 | */ |
| 287 | - protected function printBody($prefix='') |
|
| 287 | + protected function printBody($prefix = '') |
|
| 288 | 288 | { |
| 289 | 289 | echo $prefix.'<BODY '.$this->body_tags.'>'; |
| 290 | 290 | echo $prefix.$prefix.$this->body."\n"; |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function currentURL() |
| 314 | 314 | { |
| 315 | - if(!isset($_SERVER['REQUEST_URI'])) |
|
| 315 | + if (!isset($_SERVER['REQUEST_URI'])) |
|
| 316 | 316 | { |
| 317 | 317 | return ''; |
| 318 | 318 | } |
| 319 | 319 | $requestURI = $_SERVER['REQUEST_URI']; |
| 320 | - if($requestURI[0] === '/') |
|
| 320 | + if ($requestURI[0] === '/') |
|
| 321 | 321 | { |
| 322 | 322 | $requestURI = substr($requestURI, 1); |
| 323 | 323 | } |
| 324 | - return 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 324 | + return 'http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | protected function __construct() |
| 38 | 38 | { |
| 39 | 39 | $this->methods = array(); |
| 40 | - if(isset(FlipsideSettings::$email_providers)) |
|
| 40 | + if (isset(FlipsideSettings::$email_providers)) |
|
| 41 | 41 | { |
| 42 | 42 | $keys = array_keys(FlipsideSettings::$email_providers); |
| 43 | 43 | $count = count($keys); |
| 44 | - for($i = 0; $i < $count; $i++) |
|
| 44 | + for ($i = 0; $i < $count; $i++) |
|
| 45 | 45 | { |
| 46 | 46 | $class = $keys[$i]; |
| 47 | 47 | array_push($this->methods, new $class(FlipsideSettings::$email_providers[$keys[$i]])); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | public function getEmailMethod($methodName) |
| 60 | 60 | { |
| 61 | 61 | $count = count($this->methods); |
| 62 | - for($i = 0; $i < $count; $i++) |
|
| 62 | + for ($i = 0; $i < $count; $i++) |
|
| 63 | 63 | { |
| 64 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 64 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 65 | 65 | { |
| 66 | 66 | return $this->methods[$i]; |
| 67 | 67 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function sendEmail($email, $methodName = false) |
| 81 | 81 | { |
| 82 | - if($methodName === false) |
|
| 82 | + if ($methodName === false) |
|
| 83 | 83 | { |
| 84 | 84 | $res = false; |
| 85 | 85 | $count = count($this->methods); |
| 86 | - for($i = 0; $i < $count; $i++) |
|
| 86 | + for ($i = 0; $i < $count; $i++) |
|
| 87 | 87 | { |
| 88 | 88 | $res = $this->methods[$i]->sendEmail($email); |
| 89 | - if($res !== false) |
|
| 89 | + if ($res !== false) |
|
| 90 | 90 | { |
| 91 | 91 | return $res; |
| 92 | 92 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | public function sendEmail($email) |
| 29 | 29 | { |
| 30 | - if($email->hasAttachments()) |
|
| 30 | + if ($email->hasAttachments()) |
|
| 31 | 31 | { |
| 32 | 32 | //Amazeon sendEmail doesn't support attachments. We need to use sendRawEmail |
| 33 | 33 | $args = array(); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public $server; |
| 7 | 7 | |
| 8 | - function __construct($array=false, $server=false) |
|
| 8 | + function __construct($array = false, $server = false) |
|
| 9 | 9 | { |
| 10 | 10 | parent::__construct($array); |
| 11 | 11 | $this->server = $server; |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | $ret = array(); |
| 17 | 17 | foreach ($this as $key => $value) |
| 18 | 18 | { |
| 19 | - if($key === 'server' || $key === 'count') continue; |
|
| 20 | - if(is_numeric($key)) continue; |
|
| 21 | - if($key === 'jpegphoto') |
|
| 19 | + if ($key === 'server' || $key === 'count') continue; |
|
| 20 | + if (is_numeric($key)) continue; |
|
| 21 | + if ($key === 'jpegphoto') |
|
| 22 | 22 | { |
| 23 | 23 | $ret[$key] = base64_encode($value[0]); |
| 24 | 24 | continue; |
| 25 | 25 | } |
| 26 | - if(is_array($value) && $value['count'] === 1) |
|
| 26 | + if (is_array($value) && $value['count'] === 1) |
|
| 27 | 27 | { |
| 28 | 28 | $ret[$key] = $value[0]; |
| 29 | 29 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * use the FlipsideSettings class |
| 16 | 16 | */ |
| 17 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 17 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
| 18 | 18 | { |
| 19 | 19 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
| 20 | 20 | } |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | static function getDataSetByName($setName) |
| 60 | 60 | { |
| 61 | 61 | static $instances = array(); |
| 62 | - if(isset($instances[$setName])) |
|
| 62 | + if (isset($instances[$setName])) |
|
| 63 | 63 | { |
| 64 | 64 | return $instances[$setName]; |
| 65 | 65 | } |
| 66 | - if(!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
| 66 | + if (!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$setName])) |
|
| 67 | 67 | { |
| 68 | 68 | throw new Exception('Unknown dataset name '.$setName); |
| 69 | 69 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function send_HTML($mail) |
| 24 | 24 | { |
| 25 | - if(isset($mail['from'])) |
|
| 25 | + if (isset($mail['from'])) |
|
| 26 | 26 | { |
| 27 | 27 | $this->From = $mail['from']; |
| 28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $this->From = $this->Username; |
| 32 | 32 | } |
| 33 | - if(isset($mail['from_name'])) |
|
| 33 | + if (isset($mail['from_name'])) |
|
| 34 | 34 | { |
| 35 | 35 | $this->FromName = $mail['from_name']; |
| 36 | 36 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->FromName = 'Burning Flipside'; |
| 40 | 40 | } |
| 41 | 41 | $this->clearAllRecipients(); |
| 42 | - if(is_array($mail['to'])) |
|
| 42 | + if (is_array($mail['to'])) |
|
| 43 | 43 | { |
| 44 | 44 | array_walk($mail['to'], 'FlipsideMail::addTo', $this); |
| 45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $this->addAddress($mail['to']); |
| 49 | 49 | } |
| 50 | - if(isset($mail['reply_to'])) |
|
| 50 | + if (isset($mail['reply_to'])) |
|
| 51 | 51 | { |
| 52 | 52 | $this->addReplyTo($mail['reply_to']); |
| 53 | 53 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | static $instances = array(); |
| 30 | 30 | $class = get_called_class(); |
| 31 | - if(!isset($instances[$class])) |
|
| 31 | + if (!isset($instances[$class])) |
|
| 32 | 32 | { |
| 33 | 33 | $instances[$class] = new static(); |
| 34 | 34 | } |
@@ -16,18 +16,18 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * This class can be serialized to various formats |
| 18 | 18 | */ |
| 19 | -class SerializableObject implements ArrayAccess,JsonSerializable |
|
| 19 | +class SerializableObject implements ArrayAccess, JsonSerializable |
|
| 20 | 20 | { |
| 21 | 21 | /** |
| 22 | 22 | * Create the object from an array |
| 23 | 23 | * |
| 24 | 24 | * @param array $array The array of object properties |
| 25 | 25 | */ |
| 26 | - public function __construct($array=false) |
|
| 26 | + public function __construct($array = false) |
|
| 27 | 27 | { |
| 28 | - if($array !== false && is_array($array)) |
|
| 28 | + if ($array !== false && is_array($array)) |
|
| 29 | 29 | { |
| 30 | - foreach($array as $key => $value) |
|
| 30 | + foreach ($array as $key => $value) |
|
| 31 | 31 | { |
| 32 | 32 | $this->{$key} = $value; |
| 33 | 33 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $xml = new XmlWriter(); |
| 55 | 55 | $xml->openMemory(); |
| 56 | 56 | $xml->startDocument('1.0'); |
| 57 | - if(isset($this[0])) |
|
| 57 | + if (isset($this[0])) |
|
| 58 | 58 | { |
| 59 | 59 | $xml->startElement('Array'); |
| 60 | 60 | $this->array2XML($xml, 'Entity', (array)$this); |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private function object2XML(XMLWriter $xml, $data) |
| 78 | 78 | { |
| 79 | - foreach($data as $key => $value) |
|
| 79 | + foreach ($data as $key => $value) |
|
| 80 | 80 | { |
| 81 | - if(is_array($value) || is_numeric($key)) |
|
| 81 | + if (is_array($value) || is_numeric($key)) |
|
| 82 | 82 | { |
| 83 | 83 | $this->array2XML($xml, $key, (array)$value); |
| 84 | 84 | } |
| 85 | - else if(is_object($value)) |
|
| 85 | + else if (is_object($value)) |
|
| 86 | 86 | { |
| 87 | 87 | $xml->startElement($key); |
| 88 | 88 | $this->object2XML($xml, $value); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | else |
| 92 | 92 | { |
| 93 | - if($key[0] === '$') |
|
| 93 | + if ($key[0] === '$') |
|
| 94 | 94 | { |
| 95 | 95 | $xml->writeElement(substr($key, 1), $value); |
| 96 | 96 | } |
@@ -112,29 +112,29 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function array2XML(XMLWriter $xml, $keyParent, $data) |
| 114 | 114 | { |
| 115 | - foreach($data as $key => $value) |
|
| 115 | + foreach ($data as $key => $value) |
|
| 116 | 116 | { |
| 117 | - if(is_string($value)) |
|
| 117 | + if (is_string($value)) |
|
| 118 | 118 | { |
| 119 | 119 | $xml->writeElement($keyParent, $value); |
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | - if(is_numeric($key)) |
|
| 122 | + if (is_numeric($key)) |
|
| 123 | 123 | { |
| 124 | 124 | $xml->startElement($keyParent); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if(is_object($value)) |
|
| 127 | + if (is_object($value)) |
|
| 128 | 128 | { |
| 129 | 129 | $this->object2XML($xml, $value); |
| 130 | 130 | } |
| 131 | - else if(is_array($value)) |
|
| 131 | + else if (is_array($value)) |
|
| 132 | 132 | { |
| 133 | 133 | $this->array2XML($xml, $key, $value); |
| 134 | 134 | continue; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if(is_numeric($key)) |
|
| 137 | + if (is_numeric($key)) |
|
| 138 | 138 | { |
| 139 | 139 | $xml->endElement(); |
| 140 | 140 | } |
@@ -165,16 +165,16 @@ discard block |
||
| 165 | 165 | public function serializeObject($fmt = 'json', $select = false) |
| 166 | 166 | { |
| 167 | 167 | $copy = $this; |
| 168 | - if($select !== false) |
|
| 168 | + if ($select !== false) |
|
| 169 | 169 | { |
| 170 | 170 | $copy = new self(); |
| 171 | 171 | $count = count($select); |
| 172 | - for($i = 0; $i < $count; $i++) |
|
| 172 | + for ($i = 0; $i < $count; $i++) |
|
| 173 | 173 | { |
| 174 | 174 | $copy->{$select[$i]} = $this->offsetGet($select[$i]); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | - switch($fmt) |
|
| 177 | + switch ($fmt) |
|
| 178 | 178 | { |
| 179 | 179 | case 'json': |
| 180 | 180 | return json_encode($copy); |