Completed
Pull Request — master (#801)
by Jared
13:18
created
lib/image/timber-image-operation-tojpg.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	 *                               (ex: /src/var/www/wp-content/uploads/my-pic.png)
36 36
 	 * @return bool                  true if everything went fine, false otherwise
37 37
 	 */
38
-	function run($load_filename, $save_filename){
39
-		$input = self::image_create( $load_filename );
40
-		list( $width, $height ) = getimagesize( $load_filename );
41
-		$output = imagecreatetruecolor( $width, $height );
42
-		$c = self::hexrgb( $this->color );
43
-		$color = imagecolorallocate( $output, $c['red'], $c['green'], $c['blue'] );
44
-		imagefilledrectangle( $output, 0, 0, $width, $height, $color );
45
-		imagecopy( $output, $input, 0, 0, 0, 0, $width, $height );
46
-		imagejpeg( $output, $save_filename );
38
+	function run($load_filename, $save_filename) {
39
+		$input = self::image_create($load_filename);
40
+		list($width, $height) = getimagesize($load_filename);
41
+		$output = imagecreatetruecolor($width, $height);
42
+		$c = self::hexrgb($this->color);
43
+		$color = imagecolorallocate($output, $c['red'], $c['green'], $c['blue']);
44
+		imagefilledrectangle($output, 0, 0, $width, $height, $color);
45
+		imagecopy($output, $input, 0, 0, 0, 0, $width, $height);
46
+		imagejpeg($output, $save_filename);
47 47
 		return true;
48 48
 	}
49 49
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @return resource an image identifier representing the image obtained from the given filename
52 52
 	 *                  will return the same data type regardless of whether the source is gif or png
53 53
 	 */
54
-	function image_create( $filename, $ext = 'auto' ) {
54
+	function image_create($filename, $ext = 'auto') {
55 55
 		if ( $ext == 'auto' ) {
56 56
 			$ext = wp_check_filetype($filename);
57
-			if (isset($ext['ext'])) {
57
+			if ( isset($ext['ext']) ) {
58 58
 				$ext = $ext['ext'];
59 59
 			}
60 60
 		}
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 		if ( $ext == 'png' ) {
66 66
 			return imagecreatefrompng($filename);
67 67
 		}
68
-		if ( $ext == 'jpg' || $ext == 'jpeg') {
68
+		if ( $ext == 'jpg' || $ext == 'jpeg' ) {
69 69
 			return imagecreatefromjpeg($filename);
70 70
 		}
71
-		throw new InvalidArgumentException('image_create only accepts PNG, GIF and JPGs. File extension was: '.$ext);
71
+		throw new InvalidArgumentException('image_create only accepts PNG, GIF and JPGs. File extension was: ' . $ext);
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
lib/timber-term-getter.php 1 patch
Braces   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@  discard block
 block discarded – undo
8 8
      * @param string $TermClass
9 9
      * @return mixed
10 10
      */
11
-    public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm'){
12
-        if (is_string($maybe_args) && !strstr($maybe_args, '=')){
11
+    public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm') {
12
+        if (is_string($maybe_args) && !strstr($maybe_args, '=')) {
13 13
             //the user is sending the $TermClass in the second argument
14 14
             $TermClass = $maybe_args;
15 15
         }
16
-        if (is_string($maybe_args) && strstr($maybe_args, '=')){
16
+        if (is_string($maybe_args) && strstr($maybe_args, '=')) {
17 17
             parse_str($maybe_args, $maybe_args);
18 18
         }
19
-        if (is_string($args) && strstr($args, '=')){
19
+        if (is_string($args) && strstr($args, '=')) {
20 20
             //a string and a query string!
21 21
             $parsed = self::get_term_query_from_query_string($args);
22
-            if (is_array($maybe_args)){
22
+            if (is_array($maybe_args)) {
23 23
                 $parsed->args = array_merge($parsed->args, $maybe_args);
24 24
             }
25 25
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
26
-        } else if (is_string($args)){
26
+        } else if (is_string($args)) {
27 27
             //its just a string with a single taxonomy
28 28
             $parsed = self::get_term_query_from_string($args);
29
-            if (is_array($maybe_args)){
29
+            if (is_array($maybe_args)) {
30 30
                 $parsed->args = array_merge($parsed->args, $maybe_args);
31 31
             }
32 32
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
33
-        } else if (is_array($args) && TimberHelper::is_array_assoc($args)){
33
+        } else if (is_array($args) && TimberHelper::is_array_assoc($args)) {
34 34
             //its an associative array, like a good ole query
35 35
             $parsed = self::get_term_query_from_assoc_array($args);
36 36
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
37
-        } else if (is_array($args)){
37
+        } else if (is_array($args)) {
38 38
             //its just an array of strings or IDs (hopefully)
39 39
             $parsed = self::get_term_query_from_array($args);
40
-            if (is_array($maybe_args)){
40
+            if (is_array($maybe_args)) {
41 41
                 $parsed->args = array_merge($parsed->args, $maybe_args);
42 42
             }
43 43
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
      * @param string $TermClass
54 54
      * @return mixed
55 55
      */
56
-    public static function handle_term_query($taxonomies, $args, $TermClass){
57
-        if (!isset($args['hide_empty'])){
56
+    public static function handle_term_query($taxonomies, $args, $TermClass) {
57
+        if (!isset($args['hide_empty'])) {
58 58
             $args['hide_empty'] = false;
59 59
         }
60
-        if (isset($args['term_id']) && is_int($args['term_id'])){
60
+        if (isset($args['term_id']) && is_int($args['term_id'])) {
61 61
             $args['term_id'] = array($args['term_id']);
62 62
         }
63
-        if (isset($args['term_id'])){
63
+        if (isset($args['term_id'])) {
64 64
             $args['include'] = $args['term_id'];
65 65
         }
66 66
         $terms = get_terms($taxonomies, $args);
67
-        foreach($terms as &$term){
67
+        foreach($terms as &$term) {
68 68
             $term = new $TermClass($term->term_id, $term->taxonomy);
69 69
         }
70 70
         return $terms;
Please login to merge, or discard this patch.