@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * Loop through sitemap items and see if one matches the requestUri. |
89 | 89 | * If it does, add it tot the matchedSitemapItems array |
90 | 90 | * |
91 | - * @param $request |
|
91 | + * @param Request $request |
|
92 | 92 | */ |
93 | 93 | private function sitemapMatching($request) |
94 | 94 | { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param string $template |
151 | 151 | * @param array $parameters |
152 | 152 | * |
153 | - * @return mixed |
|
153 | + * @return Component |
|
154 | 154 | * @throws \Exception |
155 | 155 | */ |
156 | 156 | private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private function config() |
67 | 67 | { |
68 | - $configPath = __DIR__ . '/../../config.json'; |
|
68 | + $configPath = __DIR__.'/../../config.json'; |
|
69 | 69 | if (realpath($configPath) !== false) { |
70 | 70 | $json = file_get_contents($configPath); |
71 | 71 | $this->config = json_decode($json); |
72 | 72 | } else { |
73 | - throw new \Exception('Couldn\'t find config file in path ' . $configPath); |
|
73 | + throw new \Exception('Couldn\'t find config file in path '.$configPath); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function sitemapMatching($request) |
94 | 94 | { |
95 | 95 | $sitemap = $this->storage->getSitemap(); |
96 | - $relativeUri = '/' . $request::$relativeUri; |
|
96 | + $relativeUri = '/'.$request::$relativeUri; |
|
97 | 97 | |
98 | 98 | foreach ($sitemap as $sitemapItem) { |
99 | 99 | if ($sitemapItem->regex) { |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | * @return mixed |
154 | 154 | * @throws \Exception |
155 | 155 | */ |
156 | - private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
|
156 | + private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
|
157 | 157 | { |
158 | - $libraryComponentName = '\\library\\components\\' . $class; |
|
159 | - $userComponentName = '\\components\\' . $class; |
|
158 | + $libraryComponentName = '\\library\\components\\'.$class; |
|
159 | + $userComponentName = '\\components\\'.$class; |
|
160 | 160 | |
161 | 161 | if (\autoLoad($libraryComponentName, false)) { |
162 | 162 | $component = new $libraryComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
163 | 163 | } elseif (\autoLoad($userComponentName, false)) { |
164 | 164 | $component = new $userComponentName($template, $this->request, $parameters, $matchedSitemapItem); |
165 | 165 | } else { |
166 | - throw new \Exception('Could not load component ' . $class); |
|
166 | + throw new \Exception('Could not load component '.$class); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | if (!$component instanceof Component) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param array $replace |
112 | 112 | * @param string $delimiter |
113 | 113 | * |
114 | - * @return mixed|string |
|
114 | + * @return string |
|
115 | 115 | */ |
116 | 116 | function slugify($str, $replace=array(), $delimiter='-') { |
117 | 117 | if( !empty($replace) ) { |
@@ -130,7 +130,6 @@ discard block |
||
130 | 130 | * Dumps a var_dump of the passed arguments with <pre> tags surrounding it. |
131 | 131 | * Dies afterwards |
132 | 132 | * |
133 | - * @param mixed $data The data to be displayed |
|
134 | 133 | */ |
135 | 134 | function dump() |
136 | 135 | { |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | return '0 seconds'; |
35 | 35 | } |
36 | 36 | |
37 | - $a = array( 365 * 24 * 60 * 60 => 'year', |
|
37 | + $a = array(365 * 24 * 60 * 60 => 'year', |
|
38 | 38 | 30 * 24 * 60 * 60 => 'month', |
39 | 39 | 24 * 60 * 60 => 'day', |
40 | 40 | 60 * 60 => 'hour', |
41 | 41 | 60 => 'minute', |
42 | 42 | 1 => 'second' |
43 | 43 | ); |
44 | - $a_plural = array( 'year' => 'years', |
|
44 | + $a_plural = array('year' => 'years', |
|
45 | 45 | 'month' => 'months', |
46 | 46 | 'day' => 'days', |
47 | 47 | 'hour' => 'hours', |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | if ($d >= 1) |
56 | 56 | { |
57 | 57 | $r = round($d); |
58 | - return $r . ' ' . ($r > 1 ? $a_plural[$str] : $str) . ' ago'; |
|
58 | + return $r.' '.($r > 1 ? $a_plural[$str] : $str).' ago'; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -function humanFileSize($size,$unit="") { |
|
64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
65 | - return number_format($size/(1<<30),2)."GB"; |
|
66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
67 | - return number_format($size/(1<<20),2)."MB"; |
|
68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
69 | - return number_format($size/(1<<10),2)."KB"; |
|
63 | +function humanFileSize($size, $unit = "") { |
|
64 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
65 | + return number_format($size / (1 << 30), 2)."GB"; |
|
66 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
67 | + return number_format($size / (1 << 20), 2)."MB"; |
|
68 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
69 | + return number_format($size / (1 << 10), 2)."KB"; |
|
70 | 70 | return number_format($size)." bytes"; |
71 | 71 | } |
72 | 72 | |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return mixed|string |
115 | 115 | */ |
116 | -function slugify($str, $replace=array(), $delimiter='-') { |
|
117 | - if( !empty($replace) ) { |
|
118 | - $str = str_replace((array)$replace, ' ', $str); |
|
116 | +function slugify($str, $replace = array(), $delimiter = '-') { |
|
117 | + if (!empty($replace)) { |
|
118 | + $str = str_replace((array) $replace, ' ', $str); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $clean = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $str); |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | { |
137 | 137 | $debug_backtrace = current(debug_backtrace()); |
138 | 138 | if (PHP_SAPI == 'cli') { |
139 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
139 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
140 | 140 | foreach (func_get_args() as $data) { |
141 | 141 | var_dump($data); |
142 | 142 | } |
143 | 143 | } else { |
144 | 144 | ob_clean(); |
145 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
145 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
146 | 146 | echo '<pre>'; |
147 | 147 | foreach (func_get_args() as $data) { |
148 | 148 | echo "<code>"; |
@@ -61,12 +61,15 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | function humanFileSize($size,$unit="") { |
64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
65 | - return number_format($size/(1<<30),2)."GB"; |
|
66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
67 | - return number_format($size/(1<<20),2)."MB"; |
|
68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
69 | - return number_format($size/(1<<10),2)."KB"; |
|
64 | + if( (!$unit && $size >= 1<<30) || $unit == "GB") { |
|
65 | + return number_format($size/(1<<30),2)."GB"; |
|
66 | + } |
|
67 | + if( (!$unit && $size >= 1<<20) || $unit == "MB") { |
|
68 | + return number_format($size/(1<<20),2)."MB"; |
|
69 | + } |
|
70 | + if( (!$unit && $size >= 1<<10) || $unit == "KB") { |
|
71 | + return number_format($size/(1<<10),2)."KB"; |
|
72 | + } |
|
70 | 73 | return number_format($size)." bytes"; |
71 | 74 | } |
72 | 75 |
@@ -73,6 +73,7 @@ discard block |
||
73 | 73 | * @see http://www.php.net/manual/en/function.image-type-to-mime-type.php |
74 | 74 | * @param string $imagePath |
75 | 75 | * @param bool $getExtension |
76 | + * @return integer |
|
76 | 77 | */ |
77 | 78 | public function GetImageMimeType($imagePath, $getExtension = false) |
78 | 79 | { |
@@ -93,7 +94,7 @@ discard block |
||
93 | 94 | * |
94 | 95 | * @see http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 |
95 | 96 | * @author alexander at alexauto dot nl |
96 | - * @param string $imagePath |
|
97 | + * @param string $p_sFile |
|
97 | 98 | * @return resource |
98 | 99 | */ |
99 | 100 | public function CreateImageFromBmp($p_sFile) |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $imageContent = file_get_contents($imageContainer); |
33 | 33 | $this->_imageResource = imagecreatefromstring($imageContent); |
34 | 34 | } |
35 | - } elseif(is_string($imageContainer)) { |
|
35 | + } elseif (is_string($imageContainer)) { |
|
36 | 36 | $this->_imageResource = imagecreatefromstring($imageContainer); |
37 | 37 | } else { |
38 | - throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>' . var_export($imageContainer, true) . '</pre>'); |
|
38 | + throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>'.var_export($imageContainer, true).'</pre>'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | if ($mimeTypeConstantValue == IMAGETYPE_GIF) { |
57 | 57 | return imagegif($imageResource, $path); |
58 | - } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
58 | + } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
59 | 59 | return imagejpeg($imageResource, $path, $quality); |
60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
61 | - return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
|
61 | + return imagepng($imageResource, $path, (intval($quality / 10) - 1)); |
|
62 | 62 | } |
63 | 63 | else { |
64 | 64 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (function_exists('exif_imagetype')) { |
80 | 80 | $exif = exif_imagetype($imagePath); |
81 | 81 | } else { |
82 | - if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false ) { |
|
82 | + if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false) { |
|
83 | 83 | $exif = $type; |
84 | 84 | } else { |
85 | 85 | $exif = false; |
@@ -99,84 +99,84 @@ discard block |
||
99 | 99 | public function CreateImageFromBmp($p_sFile) |
100 | 100 | { |
101 | 101 | // Load the image into a string |
102 | - $file = fopen($p_sFile,"rb"); |
|
103 | - $read = fread($file,10); |
|
104 | - while(!feof($file)&&($read<>"")) |
|
105 | - $read .= fread($file,1024); |
|
102 | + $file = fopen($p_sFile, "rb"); |
|
103 | + $read = fread($file, 10); |
|
104 | + while (!feof($file) && ($read <> "")) |
|
105 | + $read .= fread($file, 1024); |
|
106 | 106 | |
107 | - $temp = unpack("H*",$read); |
|
108 | - $hex = $temp[1]; |
|
109 | - $header = substr($hex,0,108); |
|
107 | + $temp = unpack("H*", $read); |
|
108 | + $hex = $temp[1]; |
|
109 | + $header = substr($hex, 0, 108); |
|
110 | 110 | |
111 | 111 | // Process the header |
112 | 112 | // Structure: http://www.fastgraph.com/help/bmp_header_format.html |
113 | - if (substr($header,0,4)=="424d") |
|
113 | + if (substr($header, 0, 4) == "424d") |
|
114 | 114 | { |
115 | 115 | // Cut it in parts of 2 bytes |
116 | - $header_parts = str_split($header,2); |
|
116 | + $header_parts = str_split($header, 2); |
|
117 | 117 | |
118 | 118 | // Get the width 4 bytes |
119 | - $width = hexdec($header_parts[19].$header_parts[18]); |
|
119 | + $width = hexdec($header_parts[19].$header_parts[18]); |
|
120 | 120 | |
121 | 121 | // Get the height 4 bytes |
122 | - $height = hexdec($header_parts[23].$header_parts[22]); |
|
122 | + $height = hexdec($header_parts[23].$header_parts[22]); |
|
123 | 123 | |
124 | 124 | // Unset the header params |
125 | 125 | unset($header_parts); |
126 | 126 | } |
127 | 127 | |
128 | 128 | // Define starting X and Y |
129 | - $x = 0; |
|
130 | - $y = 1; |
|
129 | + $x = 0; |
|
130 | + $y = 1; |
|
131 | 131 | |
132 | 132 | // Create newimage |
133 | - $image = imagecreatetruecolor($width,$height); |
|
133 | + $image = imagecreatetruecolor($width, $height); |
|
134 | 134 | |
135 | 135 | // Grab the body from the image |
136 | - $body = substr($hex,108); |
|
136 | + $body = substr($hex, 108); |
|
137 | 137 | |
138 | 138 | // Calculate if padding at the end-line is needed |
139 | 139 | // Divided by two to keep overview. |
140 | 140 | // 1 byte = 2 HEX-chars |
141 | - $body_size = (strlen($body)/2); |
|
142 | - $header_size = ($width*$height); |
|
141 | + $body_size = (strlen($body) / 2); |
|
142 | + $header_size = ($width * $height); |
|
143 | 143 | |
144 | 144 | // Use end-line padding? Only when needed |
145 | - $usePadding = ($body_size>($header_size*3)+4); |
|
145 | + $usePadding = ($body_size > ($header_size * 3) + 4); |
|
146 | 146 | |
147 | 147 | // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption |
148 | 148 | // Calculate the next DWORD-position in the body |
149 | - for ($i=0;$i<$body_size;$i+=3) |
|
149 | + for ($i = 0; $i < $body_size; $i += 3) |
|
150 | 150 | { |
151 | 151 | // Calculate line-ending and padding |
152 | - if ($x>=$width) |
|
152 | + if ($x >= $width) |
|
153 | 153 | { |
154 | 154 | // If padding needed, ignore image-padding |
155 | 155 | // Shift i to the ending of the current 32-bit-block |
156 | 156 | if ($usePadding) |
157 | - $i += $width%4; |
|
157 | + $i += $width % 4; |
|
158 | 158 | |
159 | 159 | // Reset horizontal position |
160 | - $x = 0; |
|
160 | + $x = 0; |
|
161 | 161 | |
162 | 162 | // Raise the height-position (bottom-up) |
163 | 163 | $y++; |
164 | 164 | |
165 | 165 | // Reached the image-height? Break the for-loop |
166 | - if ($y>$height) |
|
166 | + if ($y > $height) |
|
167 | 167 | break; |
168 | 168 | } |
169 | 169 | |
170 | 170 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
171 | 171 | // Define $i_pos as absolute position in the body |
172 | - $i_pos = $i*2; |
|
173 | - $r = hexdec($body[$i_pos+4].$body[$i_pos+5]); |
|
174 | - $g = hexdec($body[$i_pos+2].$body[$i_pos+3]); |
|
175 | - $b = hexdec($body[$i_pos].$body[$i_pos+1]); |
|
172 | + $i_pos = $i * 2; |
|
173 | + $r = hexdec($body[$i_pos + 4].$body[$i_pos + 5]); |
|
174 | + $g = hexdec($body[$i_pos + 2].$body[$i_pos + 3]); |
|
175 | + $b = hexdec($body[$i_pos].$body[$i_pos + 1]); |
|
176 | 176 | |
177 | 177 | // Calculate and draw the pixel |
178 | - $color = imagecolorallocate($image,$r,$g,$b); |
|
179 | - imagesetpixel($image,$x,$height-$y,$color); |
|
178 | + $color = imagecolorallocate($image, $r, $g, $b); |
|
179 | + imagesetpixel($image, $x, $height - $y, $color); |
|
180 | 180 | |
181 | 181 | // Raise the horizontal position |
182 | 182 | $x++; |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | return imagejpeg($imageResource, $path, $quality); |
60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
61 | 61 | return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
62 | - } |
|
63 | - else { |
|
62 | + } else { |
|
64 | 63 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
65 | 64 | } |
66 | 65 | return false; |
@@ -101,8 +100,9 @@ discard block |
||
101 | 100 | // Load the image into a string |
102 | 101 | $file = fopen($p_sFile,"rb"); |
103 | 102 | $read = fread($file,10); |
104 | - while(!feof($file)&&($read<>"")) |
|
105 | - $read .= fread($file,1024); |
|
103 | + while(!feof($file)&&($read<>"")) { |
|
104 | + $read .= fread($file,1024); |
|
105 | + } |
|
106 | 106 | |
107 | 107 | $temp = unpack("H*",$read); |
108 | 108 | $hex = $temp[1]; |
@@ -153,8 +153,9 @@ discard block |
||
153 | 153 | { |
154 | 154 | // If padding needed, ignore image-padding |
155 | 155 | // Shift i to the ending of the current 32-bit-block |
156 | - if ($usePadding) |
|
157 | - $i += $width%4; |
|
156 | + if ($usePadding) { |
|
157 | + $i += $width%4; |
|
158 | + } |
|
158 | 159 | |
159 | 160 | // Reset horizontal position |
160 | 161 | $x = 0; |
@@ -163,8 +164,9 @@ discard block |
||
163 | 164 | $y++; |
164 | 165 | |
165 | 166 | // Reached the image-height? Break the for-loop |
166 | - if ($y>$height) |
|
167 | - break; |
|
167 | + if ($y>$height) { |
|
168 | + break; |
|
169 | + } |
|
168 | 170 | } |
169 | 171 | |
170 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
@@ -24,6 +24,9 @@ discard block |
||
24 | 24 | $this->imageSet = $imageSet; |
25 | 25 | } |
26 | 26 | |
27 | + /** |
|
28 | + * @param string $imagePath |
|
29 | + */ |
|
27 | 30 | public function applyImageSetToImage($imagePath) |
28 | 31 | { |
29 | 32 | $returnFileNames = array(); |
@@ -104,6 +107,12 @@ discard block |
||
104 | 107 | } |
105 | 108 | } |
106 | 109 | |
110 | + /** |
|
111 | + * @param string $imagePath |
|
112 | + * @param string $modifier |
|
113 | + * |
|
114 | + * @return string |
|
115 | + */ |
|
107 | 116 | private function modifyName($imagePath, $modifier) |
108 | 117 | { |
109 | 118 | $filename = basename($imagePath); |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | } |
41 | 41 | return $returnFileNames; |
42 | 42 | } else { |
43 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
43 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - public function resize($imagePath='', $width='',$height='') |
|
47 | + public function resize($imagePath = '', $width = '', $height = '') |
|
48 | 48 | { |
49 | - $modifier = '-r' . $width . 'x' . $height; |
|
49 | + $modifier = '-r'.$width.'x'.$height; |
|
50 | 50 | $destination = $this->modifyName($imagePath, $modifier); |
51 | 51 | if (file_exists($imagePath)) { |
52 | 52 | $image = new Image(); |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
61 | 61 | return basename($destination); |
62 | 62 | } else { |
63 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
63 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public function smartcrop($imagePath='', $width='',$height='') |
|
67 | + public function smartcrop($imagePath = '', $width = '', $height = '') |
|
68 | 68 | { |
69 | - $modifier = '-s' . $width . 'x' . $height; |
|
69 | + $modifier = '-s'.$width.'x'.$height; |
|
70 | 70 | $destination = $this->modifyName($imagePath, $modifier); |
71 | 71 | if (file_exists($imagePath)) { |
72 | 72 | $image = new Image(); |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
81 | 81 | return basename($destination); |
82 | 82 | } else { |
83 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
83 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - public function boxcrop($imagePath='', $width='',$height='') |
|
87 | + public function boxcrop($imagePath = '', $width = '', $height = '') |
|
88 | 88 | { |
89 | - $modifier = '-b' . $width . 'x' . $height; |
|
89 | + $modifier = '-b'.$width.'x'.$height; |
|
90 | 90 | $destination = $this->modifyName($imagePath, $modifier); |
91 | 91 | if (file_exists($imagePath)) { |
92 | 92 | $image = new Image(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $resizedImage->SaveImage($destination, $resizedImage->GetImageMimeType($imagePath), 80); |
101 | 101 | return basename($destination); |
102 | 102 | } else { |
103 | - throw new \Exception('Image doesnt exist: ' . $imagePath); |
|
103 | + throw new \Exception('Image doesnt exist: '.$imagePath); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | array_pop($fileParts); |
115 | 115 | $fileNameWithoutExtension = implode('-', $fileParts); |
116 | 116 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
117 | - $filename = $fileNameWithoutExtension . $modifier . '.' . $extension; |
|
117 | + $filename = $fileNameWithoutExtension.$modifier.'.'.$extension; |
|
118 | 118 | } else { |
119 | 119 | $filename = slugify($filename); |
120 | 120 | } |
121 | 121 | |
122 | - if (file_exists($path . '/' . $filename)) { |
|
122 | + if (file_exists($path.'/'.$filename)) { |
|
123 | 123 | $fileParts = explode('.', $filename); |
124 | 124 | if (count($fileParts) > 1) { |
125 | 125 | $extension = end($fileParts); |
126 | 126 | array_pop($fileParts); |
127 | 127 | $fileNameWithoutExtension = implode('-', $fileParts); |
128 | 128 | $fileNameWithoutExtension .= '-copy'; |
129 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
129 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
130 | 130 | } else { |
131 | 131 | $filename .= '-copy'; |
132 | 132 | } |
133 | - return $this->modifyName($path . '/' . $filename); |
|
133 | + return $this->modifyName($path.'/'.$filename); |
|
134 | 134 | } |
135 | - return $path . '/' . $filename; |
|
135 | + return $path.'/'.$filename; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | private function validateFilename($filename, $path) |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Use build-in logic to position the x of watermark |
58 | 58 | * |
59 | - * @param string $x |
|
60 | - * @return self |
|
59 | + * @param resource $imageResource |
|
60 | + * @return integer |
|
61 | 61 | */ |
62 | 62 | protected function calculateX($imageResource) |
63 | 63 | { |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * Use build-in logic to position the y of watermark |
83 | 83 | * |
84 | - * @param string $y |
|
85 | - * @return self |
|
84 | + * @param resource $imageResource |
|
85 | + * @return integer |
|
86 | 86 | */ |
87 | 87 | public function calculateY($imageResource) |
88 | 88 | { |
@@ -131,6 +131,7 @@ discard block |
||
131 | 131 | * Set the x |
132 | 132 | * |
133 | 133 | * @param int | string $x |
134 | + * @param string $x |
|
134 | 135 | * @return self |
135 | 136 | */ |
136 | 137 | public function SetX($x) |
@@ -143,6 +144,7 @@ discard block |
||
143 | 144 | * Set the y |
144 | 145 | * |
145 | 146 | * @param int | string $y |
147 | + * @param string $y |
|
146 | 148 | * @return self |
147 | 149 | */ |
148 | 150 | public function SetY($y) |
@@ -61,7 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function calculateX($imageResource) |
63 | 63 | { |
64 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
64 | + if (intval($this->_x) === $this->_x) { |
|
65 | + return $this->_x; |
|
66 | + } |
|
65 | 67 | |
66 | 68 | $x = strtolower($this->_x); |
67 | 69 | |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | */ |
87 | 89 | public function calculateY($imageResource) |
88 | 90 | { |
89 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
91 | + if (intval($this->_y) === $this->_y) { |
|
92 | + return $this->_y; |
|
93 | + } |
|
90 | 94 | |
91 | 95 | $y = strtolower($this->_y); |
92 | 96 | |
@@ -123,7 +127,9 @@ discard block |
||
123 | 127 | */ |
124 | 128 | public function GetWatermark() |
125 | 129 | { |
126 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
130 | + if ($this->_watermark == null) { |
|
131 | + throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
132 | + } |
|
127 | 133 | return $this->_watermark; |
128 | 134 | } |
129 | 135 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * JsonStorage constructor. |
19 | 19 | * |
20 | - * @param $storagePath |
|
20 | + * @param string $storagePath |
|
21 | 21 | */ |
22 | 22 | public function __construct($storagePath) |
23 | 23 | { |
@@ -837,6 +837,9 @@ discard block |
||
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
840 | + /** |
|
841 | + * @param string $path |
|
842 | + */ |
|
840 | 843 | private function validateFilename($filename, $path) |
841 | 844 | { |
842 | 845 | $fileParts = explode('.', $filename); |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | */ |
34 | 34 | private function config() |
35 | 35 | { |
36 | - $storagePath = __DIR__ . $this->storagePath; |
|
36 | + $storagePath = __DIR__.$this->storagePath; |
|
37 | 37 | if (realpath($storagePath) !== false) { |
38 | 38 | $jsonString = file_get_contents($storagePath); |
39 | 39 | $this->repository = json_decode($jsonString); |
40 | 40 | } else { |
41 | 41 | // Here is some logic for the initialisation of a new clone of the framework |
42 | 42 | initFramework($storagePath); |
43 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
43 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | public function getDocumentBySlug($slug) |
187 | 187 | { |
188 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
188 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
189 | 189 | $indices = $documentContainer['indices']; |
190 | 190 | |
191 | 191 | $folder = $this->repository->documents; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // Check for duplicates |
225 | 225 | foreach ($this->repository->documents as $index => $document) { |
226 | 226 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
227 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
227 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | // Check for duplicates |
233 | 233 | foreach ($previousFolder->content as $index => $document) { |
234 | 234 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'document') { |
235 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
235 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
236 | 236 | } |
237 | 237 | } |
238 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
238 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | $this->save(); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | foreach ($this->repository->documents as $document) { |
250 | 250 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
251 | 251 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
252 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
252 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | $this->repository->documents[] = $documentFolderObject; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | foreach ($containerFolder->content as $document) { |
272 | 272 | if ($document->slug == $documentFolderObject->slug && $document->type == 'document') { |
273 | 273 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
274 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
274 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | foreach ($this->repository->documents as $document) { |
355 | 355 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
356 | 356 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
357 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
357 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | $this->repository->documents[] = $documentFolderObject; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | foreach ($containerFolder->content as $document) { |
376 | 376 | if ($document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
377 | 377 | // TODO make it so it doesnt throw an exception, but instead shows a warning |
378 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
378 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | $folder->content[] = $documentFolderObject; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function getDocumentFolderBySlug($slug) |
429 | 429 | { |
430 | - $documentContainer = $this->getDocumentContainerByPath('/' . $slug); |
|
430 | + $documentContainer = $this->getDocumentContainerByPath('/'.$slug); |
|
431 | 431 | $indices = $documentContainer['indices']; |
432 | 432 | |
433 | 433 | $folder = $this->repository->documents; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | // Check for duplicates |
474 | 474 | foreach ($this->repository->documents as $index => $document) { |
475 | 475 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
476 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
476 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | $this->repository->documents[end($indices)] = $documentFolderObject; |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | // Check for duplicates |
482 | 482 | foreach ($previousFolder->content as $index => $document) { |
483 | 483 | if (end($indices) !== $index && $document->slug == $documentFolderObject->slug && $document->type == 'folder') { |
484 | - throw new \Exception('Duplicate slug: ' . $document->slug . ' in folder ' . $postValues['path']); |
|
484 | + throw new \Exception('Duplicate slug: '.$document->slug.' in folder '.$postValues['path']); |
|
485 | 485 | } |
486 | 486 | } |
487 | - $previousFolder->content[end($indices)] = $documentFolderObject ; |
|
487 | + $previousFolder->content[end($indices)] = $documentFolderObject; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | $this->save(); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | if ($matched == true) { |
535 | 535 | $noMatches += 1; |
536 | 536 | } else { |
537 | - throw new \Exception('Unknown folder "' . $slug . '" in path: ' . $path); |
|
537 | + throw new \Exception('Unknown folder "'.$slug.'" in path: '.$path); |
|
538 | 538 | } |
539 | 539 | $i += 1; |
540 | 540 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | 'previousDocument' => $previousDocument |
547 | 547 | ); |
548 | 548 | } else { |
549 | - throw new \Exception('Invalid path: ' . $path); |
|
549 | + throw new \Exception('Invalid path: '.$path); |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | |
731 | 731 | public function addImage($postValues) |
732 | 732 | { |
733 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
733 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
734 | 734 | |
735 | 735 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
736 | - $destination = $destinationPath . '/' . $filename; |
|
736 | + $destination = $destinationPath.'/'.$filename; |
|
737 | 737 | |
738 | 738 | if ($postValues['error'] != '0') { |
739 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
739 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | |
759 | 759 | public function deleteImageByName($filename) |
760 | 760 | { |
761 | - $destinationPath = realpath(__DIR__ . '/../../www/images/'); |
|
762 | - $destination = $destinationPath . '/' . $filename; |
|
761 | + $destinationPath = realpath(__DIR__.'/../../www/images/'); |
|
762 | + $destination = $destinationPath.'/'.$filename; |
|
763 | 763 | |
764 | 764 | $images = $this->getImages(); |
765 | 765 | |
766 | 766 | foreach ($images as $key => $image) { |
767 | 767 | if ($image->file == $filename) { |
768 | 768 | foreach ($image->set as $imageSetFilename) { |
769 | - $destination = $destinationPath . '/' . $imageSetFilename; |
|
769 | + $destination = $destinationPath.'/'.$imageSetFilename; |
|
770 | 770 | if (file_exists($destination)) { |
771 | 771 | unlink($destination); |
772 | 772 | } else { |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | */ |
804 | 804 | public function getFiles() |
805 | 805 | { |
806 | - $files = $this->repository->files; |
|
806 | + $files = $this->repository->files; |
|
807 | 807 | usort($files, array($this, 'compareFiles')); |
808 | 808 | return $files; |
809 | 809 | } |
@@ -815,13 +815,13 @@ discard block |
||
815 | 815 | |
816 | 816 | public function addFile($postValues) |
817 | 817 | { |
818 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
818 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
819 | 819 | |
820 | 820 | $filename = $this->validateFilename($postValues['name'], $destinationPath); |
821 | - $destination = $destinationPath . '/' . $filename; |
|
821 | + $destination = $destinationPath.'/'.$filename; |
|
822 | 822 | |
823 | 823 | if ($postValues['error'] != '0') { |
824 | - throw new \Exception('Error uploading file. Error code: ' . $postValues['error']); |
|
824 | + throw new \Exception('Error uploading file. Error code: '.$postValues['error']); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | if (move_uploaded_file($postValues['tmp_name'], $destination)) { |
@@ -845,23 +845,23 @@ discard block |
||
845 | 845 | array_pop($fileParts); |
846 | 846 | $fileNameWithoutExtension = implode('-', $fileParts); |
847 | 847 | $fileNameWithoutExtension = slugify($fileNameWithoutExtension); |
848 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
848 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
849 | 849 | } else { |
850 | 850 | $filename = slugify($filename); |
851 | 851 | } |
852 | 852 | |
853 | - if (file_exists($path . '/' . $filename)) { |
|
853 | + if (file_exists($path.'/'.$filename)) { |
|
854 | 854 | $fileParts = explode('.', $filename); |
855 | 855 | if (count($fileParts) > 1) { |
856 | 856 | $extension = end($fileParts); |
857 | 857 | array_pop($fileParts); |
858 | 858 | $fileNameWithoutExtension = implode('-', $fileParts); |
859 | 859 | $fileNameWithoutExtension .= '-copy'; |
860 | - $filename = $fileNameWithoutExtension . '.' . $extension; |
|
860 | + $filename = $fileNameWithoutExtension.'.'.$extension; |
|
861 | 861 | } else { |
862 | 862 | $filename .= '-copy'; |
863 | 863 | } |
864 | - return $this->validateFilename($filename,$path); |
|
864 | + return $this->validateFilename($filename, $path); |
|
865 | 865 | } |
866 | 866 | return $filename; |
867 | 867 | } |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | |
879 | 879 | public function deleteFileByName($filename) |
880 | 880 | { |
881 | - $destinationPath = realpath(__DIR__ . '/../../www/files/'); |
|
882 | - $destination = $destinationPath . '/' . $filename; |
|
881 | + $destinationPath = realpath(__DIR__.'/../../www/files/'); |
|
882 | + $destination = $destinationPath.'/'.$filename; |
|
883 | 883 | |
884 | 884 | if (file_exists($destination)) { |
885 | 885 | $files = $this->getFiles(); |
@@ -1172,11 +1172,11 @@ discard block |
||
1172 | 1172 | * @throws \Exception |
1173 | 1173 | */ |
1174 | 1174 | private function save() { |
1175 | - $storagePath = __DIR__ . $this->storagePath; |
|
1175 | + $storagePath = __DIR__.$this->storagePath; |
|
1176 | 1176 | if (realpath($storagePath) !== false) { |
1177 | 1177 | file_put_contents($storagePath, json_encode($this->repository)); |
1178 | 1178 | } else { |
1179 | - throw new \Exception('Couldnt find storagePath ' . $storagePath); |
|
1179 | + throw new \Exception('Couldnt find storagePath '.$storagePath); |
|
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
3 | 3 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
4 | 4 | </div> |
5 | -<?$fieldPrefix = 'dynamicBricks[' . $brick->slug . '][' . time() . ']'?> |
|
5 | +<?$fieldPrefix = 'dynamicBricks['.$brick->slug.']['.time().']'?> |
|
6 | 6 | <? foreach ($brick->fields as $field) : ?> |
7 | 7 | <div class="form-element"> |
8 | 8 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
27 | 27 | <div class="form-element"> |
28 | 28 | <? endif ?> |
29 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
29 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
30 | 30 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
31 | 31 | |
32 | 32 | </div> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <li class="grid-container"> |
49 | 49 | <div class="grid-box-10"> |
50 | 50 | <div class="grid-inner form-element"> |
51 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
51 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | <div class="grid-box-2"> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | </div> |
59 | 59 | </div> |
60 | 60 | </li> |
61 | - <?$value='';?> |
|
61 | + <?$value = ''; ?> |
|
62 | 62 | <? endforeach ?> |
63 | 63 | <? endif ?> |
64 | 64 | </ul> |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
76 | 76 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
77 | 77 | <div class="form-element"> |
78 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
78 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
79 | 79 | </div> |
80 | 80 | </li> |
81 | - <?$value='';?> |
|
81 | + <?$value = ''; ?> |
|
82 | 82 | <? endforeach ?> |
83 | 83 | <? endif ?> |
84 | 84 | </div> |
@@ -87,5 +87,5 @@ discard block |
||
87 | 87 | <a class="btn js-addrtemultiple">+</a> |
88 | 88 | <? endif ?> |
89 | 89 | </div> |
90 | - <?$value='';?> |
|
90 | + <?$value = ''; ?> |
|
91 | 91 | <? endforeach ?> |
@@ -9,8 +9,10 @@ |
||
9 | 9 | <? if (isset($dynamicBrick)) : |
10 | 10 | $fieldSlug = $field->slug; |
11 | 11 | $value = isset($dynamicBrick->fields->$fieldSlug) ? current($dynamicBrick->fields->$fieldSlug) : ''; |
12 | - else : |
|
12 | + else { |
|
13 | + : |
|
13 | 14 | $value = ''; |
15 | + } |
|
14 | 16 | endif ?> |
15 | 17 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
16 | 18 | <ul class="grid-wrapper sortable"> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script> |
4 | 4 | <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet"> |
5 | 5 | <script>var smallestImage = '<?=$smallestImage?>';</script> |
6 | -<?$copyable=''?> |
|
6 | +<?$copyable = ''?> |
|
7 | 7 | <section class="documents"> |
8 | 8 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
9 | 9 | <nav class="actions"> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | <label for="state">Published</label> |
39 | 39 | <input<?=isset($document) && $document->state == 'published' ? ' checked="checked"' : '' ?> type="checkbox" id="state" name="state" placeholder="State" /> |
40 | 40 | </div> |
41 | - <?$fieldPrefix='fields';?> |
|
41 | + <?$fieldPrefix = 'fields'; ?> |
|
42 | 42 | <? foreach ($documentType->fields as $field) : ?> |
43 | 43 | <div class="form-element"> |
44 | 44 | <label for="<?=$field->slug?>"><?=$field->title?></label> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
63 | 63 | <div class="form-element"> |
64 | 64 | <? endif ?> |
65 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
65 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
66 | 66 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
67 | 67 | |
68 | 68 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | <li class="grid-container"> |
85 | 85 | <div class="grid-box-10"> |
86 | 86 | <div class="grid-inner form-element"> |
87 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
87 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
88 | 88 | </div> |
89 | 89 | </div> |
90 | 90 | <div class="grid-box-2"> |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | </div> |
95 | 95 | </div> |
96 | 96 | </li> |
97 | - <?$value='';?> |
|
97 | + <?$value = ''; ?> |
|
98 | 98 | <? endforeach ?> |
99 | 99 | <? endif ?> |
100 | 100 | </ul> |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
112 | 112 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
113 | 113 | <div class="form-element"> |
114 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
114 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
115 | 115 | </div> |
116 | 116 | </li> |
117 | - <?$value='';?> |
|
117 | + <?$value = ''; ?> |
|
118 | 118 | <? endforeach ?> |
119 | 119 | <? endif ?> |
120 | 120 | </div> |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | <a class="btn js-addrtemultiple">+</a> |
124 | 124 | <? endif ?> |
125 | 125 | </div> |
126 | - <?$value='';?> |
|
126 | + <?$value = ''; ?> |
|
127 | 127 | <? endforeach ?> |
128 | 128 | <hr /> |
129 | 129 | <? foreach ($documentType->bricks as $brick) : ?> |
130 | 130 | <div class="brick"> |
131 | 131 | <label><?=$brick->title?></label> |
132 | - <?$fieldPrefix='bricks[' . $brick->slug . '][fields]';?> |
|
132 | + <?$fieldPrefix = 'bricks['.$brick->slug.'][fields]'; ?> |
|
133 | 133 | <input type="hidden" name="bricks[<?=$brick->slug?>][type]" value="<?=$brick->brickSlug?>" /> |
134 | 134 | <? foreach ($brick->structure->fields as $field) : ?> |
135 | 135 | <div class="form-element"> |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
156 | 156 | <div class="form-element"> |
157 | 157 | <? endif ?> |
158 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
158 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
159 | 159 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
160 | 160 | |
161 | 161 | </div> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | <li class="grid-container"> |
179 | 179 | <div class="grid-box-10"> |
180 | 180 | <div class="grid-inner form-element"> |
181 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
181 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
182 | 182 | </div> |
183 | 183 | </div> |
184 | 184 | <div class="grid-box-2"> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | </div> |
189 | 189 | </div> |
190 | 190 | </li> |
191 | - <?$value='';?> |
|
191 | + <?$value = ''; ?> |
|
192 | 192 | <? endforeach ?> |
193 | 193 | <? endif ?> |
194 | 194 | </ul> |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | <a class="btn error js-deletemultiple"><i class="fa fa-times"></i></a> |
207 | 207 | <a class="btn move ui-sortable-handle"><i class="fa fa-arrows-v"></i></a> |
208 | 208 | <div class="form-element"> |
209 | - <? include(__DIR__ . '/fieldTypes/' . str_replace(' ', '-', $field->type) . '.php') ?> |
|
209 | + <? include(__DIR__.'/fieldTypes/'.str_replace(' ', '-', $field->type).'.php') ?> |
|
210 | 210 | </div> |
211 | 211 | </li> |
212 | - <?$value='';?> |
|
212 | + <?$value = ''; ?> |
|
213 | 213 | <? endforeach ?> |
214 | 214 | <? endif ?> |
215 | 215 | </div> |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | <a class="btn js-addrtemultiple">+</a> |
219 | 219 | <? endif ?> |
220 | 220 | </div> |
221 | - <?$value='';?> |
|
221 | + <?$value = ''; ?> |
|
222 | 222 | <? endforeach ?> |
223 | 223 | </div> |
224 | 224 | <hr /> |
225 | - <? endforeach;?> |
|
225 | + <? endforeach; ?> |
|
226 | 226 | <? if (count($documentType->dynamicBricks) > 0) : ?> |
227 | 227 | <div class="dynamicBrickWrapper"> |
228 | 228 | <label>Dynamic Bricks</label> |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | endforeach ?> |
242 | 242 | <li class="brick form-element"> |
243 | 243 | <label><?=$brick->title?></label> |
244 | - <?include(__DIR__ . '/brick.php')?> |
|
244 | + <?include(__DIR__.'/brick.php')?> |
|
245 | 245 | </li> |
246 | 246 | <? endforeach ?> |
247 | 247 | <? endif ?> |
@@ -45,8 +45,10 @@ discard block |
||
45 | 45 | <? if (isset($document)) : |
46 | 46 | $fieldSlug = $field->slug; |
47 | 47 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
48 | - else : |
|
48 | + else { |
|
49 | + : |
|
49 | 50 | $value = ''; |
51 | + } |
|
50 | 52 | endif ?> |
51 | 53 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
52 | 54 | <ul class="grid-wrapper sortable"> |
@@ -138,8 +140,10 @@ discard block |
||
138 | 140 | $brickSlug = $brick->slug; |
139 | 141 | $fieldSlug = $field->slug; |
140 | 142 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
141 | - else : |
|
143 | + else { |
|
144 | + : |
|
142 | 145 | $value = ''; |
146 | + } |
|
143 | 147 | endif ?> |
144 | 148 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
145 | 149 | <ul class="grid-wrapper sortable"> |
@@ -6,12 +6,12 @@ |
||
6 | 6 | } |
7 | 7 | ?> |
8 | 8 | <div class="rte"> |
9 | - <div id="summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
9 | + <div id="summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>" class="summernote"><?=isset($value) ? $value : '' ?></div> |
|
10 | 10 | </div> |
11 | 11 | <textarea style="display:none;" id="summernote_<?=$field->slug?>_container_<?=$summernoteInstances?>" name="<?=$fieldPrefix?>[<?=$field->slug?>][]"></textarea> |
12 | 12 | <script> |
13 | 13 | $(document).ready(function () { |
14 | - $('#summernote_<?=str_replace(']', '-', str_replace('[','-', $fieldPrefix)) . $field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
14 | + $('#summernote_<?=str_replace(']', '-', str_replace('[', '-', $fieldPrefix)).$field->slug?>_rte_<?=$summernoteInstances?>').summernote({ |
|
15 | 15 | height: 300, |
16 | 16 | toolbar: [ |
17 | 17 | //[groupname, [button list]] |