Completed
Push — master ( 2d9dd7...000ef9 )
by Andrey
01:52
created
php/class-extension.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 		$options = array(
17 17
 			'needs_environment' => true,
18 18
 			'needs_context'     => true,
19
-			'is_safe'           => array( 'all' )
19
+			'is_safe'           => array('all')
20 20
 		);
21 21
 
22 22
 		$functions = array();
23 23
 
24
-		foreach ( array( 'get_header', 'get_footer', 'get_sidebar', 'get_template_part', 'get_search_form', 'comments_template' ) as $function ) {
25
-			$functions[] = new \Twig_SimpleFunction( $function, array( $this, $function ), $options );
24
+		foreach (array('get_header', 'get_footer', 'get_sidebar', 'get_template_part', 'get_search_form', 'comments_template') as $function) {
25
+			$functions[] = new \Twig_SimpleFunction($function, array($this, $function), $options);
26 26
 		}
27 27
 
28 28
 		return $functions;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 		global $wp_query;
34 34
 
35
-		return compact( 'wp_query' );
35
+		return compact('wp_query');
36 36
 	}
37 37
 
38 38
 	public function getTokenParsers(  ) {
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		);
44 44
 	}
45 45
 
46
-	public function get_header( \Twig_Environment $env, $context, $name = null ) {
46
+	public function get_header(\Twig_Environment $env, $context, $name = null) {
47 47
 
48
-		return $this->get_template( $env, $context, 'header', $name );
48
+		return $this->get_template($env, $context, 'header', $name);
49 49
 	}
50 50
 
51
-	public function get_templates( $slug, $name = null ) {
51
+	public function get_templates($slug, $name = null) {
52 52
 
53 53
 		$templates = array();
54 54
 
55
-		if ( ! empty( $name ) )
55
+		if ( ! empty($name))
56 56
 			$templates[] = "{$slug}-{$name}.twig";
57 57
 
58 58
 		$templates[] = "{$slug}.twig";
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 		return $templates;
61 61
 	}
62 62
 
63
-	public function get_footer( \Twig_Environment $env, $context, $name = null ) {
63
+	public function get_footer(\Twig_Environment $env, $context, $name = null) {
64 64
 
65
-		return $this->get_template( $env, $context, 'footer', $name );
65
+		return $this->get_template($env, $context, 'footer', $name);
66 66
 	}
67 67
 
68
-	public function get_sidebar( \Twig_Environment $env, $context, $name = null ) {
68
+	public function get_sidebar(\Twig_Environment $env, $context, $name = null) {
69 69
 
70
-		return $this->get_template( $env, $context, 'sidebar', $name );
70
+		return $this->get_template($env, $context, 'sidebar', $name);
71 71
 	}
72 72
 
73
-	public function get_template_part( \Twig_Environment $env, $context, $slug, $name = null ) {
73
+	public function get_template_part(\Twig_Environment $env, $context, $slug, $name = null) {
74 74
 
75 75
 		try {
76
-			$return = twig_include( $env, $context, $this->get_templates( $slug, $name ) );
77
-			do_action( "get_template_part_{$slug}", $slug, $name );
78
-		} catch ( \Twig_Error_Loader $e ) {
76
+			$return = twig_include($env, $context, $this->get_templates($slug, $name));
77
+			do_action("get_template_part_{$slug}", $slug, $name);
78
+		} catch (\Twig_Error_Loader $e) {
79 79
 			ob_start();
80
-			get_template_part( $slug, $name );
80
+			get_template_part($slug, $name);
81 81
 			$return = ob_get_clean();
82 82
 		}
83 83
 
@@ -91,39 +91,39 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function get_search_form() {
93 93
 
94
-		return apply_filters( 'get_search_form', true );
94
+		return apply_filters('get_search_form', true);
95 95
 	}
96 96
 
97
-	protected function get_template( \Twig_Environment $env, $context, $type, $name = null ) {
97
+	protected function get_template(\Twig_Environment $env, $context, $type, $name = null) {
98 98
 
99 99
 		try {
100
-			$return = twig_include( $env, $context, $this->get_templates( $type, $name ) );
101
-			do_action( 'get_' . $type, $name );
102
-		} catch ( \Twig_Error_Loader $e ) {
100
+			$return = twig_include($env, $context, $this->get_templates($type, $name));
101
+			do_action('get_' . $type, $name);
102
+		} catch (\Twig_Error_Loader $e) {
103 103
 			ob_start();
104
-			call_user_func( 'get_' . $type, $name );
104
+			call_user_func('get_' . $type, $name);
105 105
 			$return = ob_get_clean();
106 106
 		}
107 107
 
108 108
 		return $return;
109 109
 	}
110 110
 
111
-	public function comments_template( \Twig_Environment $env, $context, $file = 'comments.twig', $separate_comments = false ) {
111
+	public function comments_template(\Twig_Environment $env, $context, $file = 'comments.twig', $separate_comments = false) {
112 112
 
113 113
 		try {
114
-			$env->loadTemplate( $file );
115
-		} catch ( \Twig_Error_Loader $e ) {
114
+			$env->loadTemplate($file);
115
+		} catch (\Twig_Error_Loader $e) {
116 116
 			ob_start();
117
-			comments_template( '/comments.php', $separate_comments );
117
+			comments_template('/comments.php', $separate_comments);
118 118
 
119 119
 			return ob_get_clean();
120 120
 		}
121 121
 
122
-		add_filter( 'comments_template', array( $this, 'return_blank_template' ) );
123
-		comments_template( '/comments.php', $separate_comments );
124
-		remove_filter( 'comments_template', array( $this, 'return_blank_template' ) );
122
+		add_filter('comments_template', array($this, 'return_blank_template'));
123
+		comments_template('/comments.php', $separate_comments);
124
+		remove_filter('comments_template', array($this, 'return_blank_template'));
125 125
 
126
-		return twig_include( $env, $context, $file );
126
+		return twig_include($env, $context, $file);
127 127
 	}
128 128
 
129 129
 	public function return_blank_template() {
Please login to merge, or discard this patch.