Passed
Push — develop ( 53bd5d...0226de )
by Paul
03:06
created
castor.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@
 block discarded – undo
5 5
 global $wp_version;
6 6
 
7 7
 if (!is_admin() && version_compare('7.1', phpversion(), '>')) {
8
-    wp_die(
9
-        __('You must be using PHP 7.1.0 or greater.', 'castor'),
10
-        __('Unsupported PHP version', 'castor')
11
-    );
8
+	wp_die(
9
+		__('You must be using PHP 7.1.0 or greater.', 'castor'),
10
+		__('Unsupported PHP version', 'castor')
11
+	);
12 12
 }
13 13
 if (!is_admin() && version_compare('5.2', $wp_version, '>')) {
14
-    wp_die(
15
-        __('You must be using WordPress 5.2.0 or greater.', 'castor'),
16
-        __('Unsupported WordPress version', 'castor')
17
-    );
14
+	wp_die(
15
+		__('You must be using WordPress 5.2.0 or greater.', 'castor'),
16
+		__('Unsupported WordPress version', 'castor')
17
+	);
18 18
 }
19 19
 if (is_customize_preview() && filter_input(INPUT_GET, 'theme')) {
20
-    wp_die(
21
-        __('Theme must be activated prior to using the customizer.', 'castor')
22
-    );
20
+	wp_die(
21
+		__('Theme must be activated prior to using the customizer.', 'castor')
22
+	);
23 23
 }
24 24
 
25 25
 define('CASTOR_FRAMEWORK_VERSION', '1.4.3');
26 26
 
27 27
 if (version_compare($wp_version, '5.3', '<')) {
28
-    require_once ABSPATH.'/'.WPINC.'/class-oembed.php';
28
+	require_once ABSPATH.'/'.WPINC.'/class-oembed.php';
29 29
 } else {
30
-    require_once ABSPATH.'/'.WPINC.'/class-wp-oembed.php';
30
+	require_once ABSPATH.'/'.WPINC.'/class-wp-oembed.php';
31 31
 }
32 32
 
33 33
 if (!function_exists('castor_app')) {
34
-    function castor_app()
35
-    {
36
-        return \GeminiLabs\Castor\Application::getInstance();
37
-    }
34
+	function castor_app()
35
+	{
36
+		return \GeminiLabs\Castor\Application::getInstance();
37
+	}
38 38
 }
39 39
 
40 40
 \GeminiLabs\Castor\Application::getInstance()->init();
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -10,211 +10,211 @@
 block discarded – undo
10 10
 
11 11
 class Controller
12 12
 {
13
-    /**
14
-     * @return void
15
-     * @action after_setup_theme
16
-     */
17
-    public function afterSetupTheme()
18
-    {
19
-        castor_app()->cssDir = trailingslashit((string) apply_filters('castor/assets/styles/dir', 'css'));
20
-        castor_app()->imgDir = trailingslashit((string) apply_filters('castor/assets/images/dir', 'img'));
21
-        castor_app()->jsDir = trailingslashit((string) apply_filters('castor/assets/scripts/dir', 'js'));
22
-
23
-        add_editor_style(Theme::assetUri(castor_app()->cssDir.'editor.css'));
24
-        add_theme_support('customize-selective-refresh-widgets');
25
-        add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
26
-        add_theme_support('post-thumbnails');
27
-        add_theme_support('soil-clean-up');
28
-        add_theme_support('soil-jquery-cdn');
29
-        add_theme_support('soil-nav-walker');
30
-        add_theme_support('soil-nice-search');
31
-        add_theme_support('soil-relative-urls');
32
-        add_theme_support('title-tag');
33
-        load_theme_textdomain('castor', Theme::paths('dir.template').'/languages');
34
-
35
-        $menus = apply_filters('castor/register/nav_menus', [
36
-            'main_menu' => __('Main Menu', 'castor'),
37
-        ]);
38
-
39
-        foreach ($menus as $location => $description) {
40
-            register_nav_menu($location, $description);
41
-        }
42
-    }
43
-
44
-    /**
45
-     * @return array
46
-     * @filter body_class
47
-     */
48
-    public function filterBodyClasses(array $classes)
49
-    {
50
-        if (Theme::displaySidebar()) {
51
-            $classes[] = 'has-sidebar';
52
-        }
53
-        return array_keys(array_flip($classes));
54
-    }
55
-
56
-    /**
57
-     * @return string
58
-     * @filter login_headertext
59
-     */
60
-    public function filterLoginTitle()
61
-    {
62
-        return get_bloginfo('name');
63
-    }
64
-
65
-    /**
66
-     * @return string
67
-     * @filter login_headerurl
68
-     */
69
-    public function filterLoginUrl()
70
-    {
71
-        return get_bloginfo('url');
72
-    }
73
-
74
-    /**
75
-     * @return string
76
-     * @filter template_include
77
-     */
78
-    public function filterTemplate($template)
79
-    {
80
-        if (is_string($template)) {
81
-            $template = Template::setLayout($template);
82
-            Development::storeTemplatePath($template);
83
-        }
84
-        return $template;
85
-    }
86
-
87
-    /**
88
-     * @return array
89
-     * @filter {$type}_template_hierarchy
90
-     */
91
-    public function filterTemplateHierarchy(array $templates)
92
-    {
93
-        return array_map(function ($template) {
94
-            return Utility::startWith('templates/', $template);
95
-        }, $templates);
96
-    }
97
-
98
-    /**
99
-     * @return void
100
-     * @action admin_head
101
-     * @action login_head
102
-     */
103
-    public function loadAdminFavicon()
104
-    {
105
-        if (file_exists(Theme::assetPath('favicon/favicon-admin.ico'))) {
106
-            printf('<link rel="shortcut icon" href="%s">', Theme::assetUri('favicon/favicon-admin.ico'));
107
-        }
108
-    }
109
-
110
-    /**
111
-     * @return void
112
-     * @action login_head
113
-     */
114
-    public function login()
115
-    {
116
-        if (file_exists(Theme::assetPath(castor_app()->cssDir.'login.css'))) {
117
-            printf('<link rel="stylesheet" href="%s">', Theme::assetUri(castor_app()->cssDir.'login.css'));
118
-        }
119
-    }
120
-
121
-    /**
122
-     * @return void
123
-     * @action admin_enqueue_scripts
124
-     */
125
-    public function registerAdminAssets()
126
-    {
127
-        if (file_exists(Theme::assetPath(castor_app()->cssDir.'admin.css'))) {
128
-            wp_enqueue_style('castor/admin.css',
129
-                Theme::assetUri(castor_app()->cssDir.'admin.css'),
130
-                apply_filters('castor/enqueue/admin/css/deps', []),
131
-                CASTOR_FRAMEWORK_VERSION
132
-            );
133
-        }
134
-        if (file_exists(Theme::assetPath(castor_app()->jsDir.'admin.js'))) {
135
-            wp_enqueue_script('castor/admin.js',
136
-                Theme::assetUri(castor_app()->jsDir.'admin.js'),
137
-                apply_filters('castor/enqueue/admin/js/deps', []),
138
-                CASTOR_FRAMEWORK_VERSION,
139
-                true
140
-            );
141
-        }
142
-    }
143
-
144
-    /**
145
-     * @return void
146
-     * @action wp_enqueue_scripts
147
-     */
148
-    public function registerAssets()
149
-    {
150
-        wp_register_style('castor/main.css',
151
-            Theme::assetUri(castor_app()->cssDir.'main.css'),
152
-            apply_filters('castor/enqueue/css/deps', []),
153
-            CASTOR_FRAMEWORK_VERSION
154
-        );
155
-        wp_register_script('castor/main.js',
156
-            Theme::assetUri(castor_app()->jsDir.'main.js'),
157
-            apply_filters('castor/enqueue/js/deps', []),
158
-            CASTOR_FRAMEWORK_VERSION,
159
-            true
160
-        );
161
-        wp_localize_script('castor/main.js', apply_filters('castor/enqueue/js/localize/variable', 'globals'),
162
-            apply_filters('castor/enqueue/js/localize/variables', [
163
-                'ajax' => admin_url('admin-ajax.php'),
164
-            ])
165
-        );
166
-        do_action('castor/register/assets');
167
-        wp_enqueue_style('castor/main.css');
168
-        wp_enqueue_script('castor/main.js');
169
-    }
170
-
171
-    /**
172
-     * @return void
173
-     * @action customize_register
174
-     */
175
-    public function registerCustomizer(WP_Customize_Manager $manager)
176
-    {
177
-        $manager->get_setting('blogname')->transport = 'postMessage';
178
-        $manager->selective_refresh->add_partial('blogname', [
179
-            'selector' => '.brand',
180
-            'render_callback' => function () {
181
-                bloginfo('name');
182
-            },
183
-        ]);
184
-    }
185
-
186
-    /**
187
-     * @return void
188
-     * @action customize_preview_init
189
-     */
190
-    public function registerCustomizerAssets()
191
-    {
192
-        wp_enqueue_script('castor/customizer.js', Theme::assetUri(castor_app()->jsDir.'customizer.js'), ['customize-preview'], CASTOR_FRAMEWORK_VERSION, true);
193
-    }
194
-
195
-    /**
196
-     * @return void
197
-     * @action widgets_init
198
-     */
199
-    public function registerSidebars()
200
-    {
201
-        $defaults = apply_filters('castor/register/sidebars/defaults', [
202
-            'before_widget' => '<div class="widget %1$s %2$s">',
203
-            'after_widget' => '</div>',
204
-            'before_title' => '<h4>',
205
-            'after_title' => '</h4>',
206
-        ]);
207
-
208
-        $sidebars = apply_filters('castor/register/sidebars', [
209
-            'sidebar-primary' => __('Primary Sidebar', 'castor'),
210
-            'sidebar-footer' => __('Footer Widgets', 'castor'),
211
-        ]);
212
-
213
-        foreach ($sidebars as $id => $name) {
214
-            register_sidebar([
215
-                'id' => $id,
216
-                'name' => $name,
217
-            ] + $defaults);
218
-        }
219
-    }
13
+	/**
14
+	 * @return void
15
+	 * @action after_setup_theme
16
+	 */
17
+	public function afterSetupTheme()
18
+	{
19
+		castor_app()->cssDir = trailingslashit((string) apply_filters('castor/assets/styles/dir', 'css'));
20
+		castor_app()->imgDir = trailingslashit((string) apply_filters('castor/assets/images/dir', 'img'));
21
+		castor_app()->jsDir = trailingslashit((string) apply_filters('castor/assets/scripts/dir', 'js'));
22
+
23
+		add_editor_style(Theme::assetUri(castor_app()->cssDir.'editor.css'));
24
+		add_theme_support('customize-selective-refresh-widgets');
25
+		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
26
+		add_theme_support('post-thumbnails');
27
+		add_theme_support('soil-clean-up');
28
+		add_theme_support('soil-jquery-cdn');
29
+		add_theme_support('soil-nav-walker');
30
+		add_theme_support('soil-nice-search');
31
+		add_theme_support('soil-relative-urls');
32
+		add_theme_support('title-tag');
33
+		load_theme_textdomain('castor', Theme::paths('dir.template').'/languages');
34
+
35
+		$menus = apply_filters('castor/register/nav_menus', [
36
+			'main_menu' => __('Main Menu', 'castor'),
37
+		]);
38
+
39
+		foreach ($menus as $location => $description) {
40
+			register_nav_menu($location, $description);
41
+		}
42
+	}
43
+
44
+	/**
45
+	 * @return array
46
+	 * @filter body_class
47
+	 */
48
+	public function filterBodyClasses(array $classes)
49
+	{
50
+		if (Theme::displaySidebar()) {
51
+			$classes[] = 'has-sidebar';
52
+		}
53
+		return array_keys(array_flip($classes));
54
+	}
55
+
56
+	/**
57
+	 * @return string
58
+	 * @filter login_headertext
59
+	 */
60
+	public function filterLoginTitle()
61
+	{
62
+		return get_bloginfo('name');
63
+	}
64
+
65
+	/**
66
+	 * @return string
67
+	 * @filter login_headerurl
68
+	 */
69
+	public function filterLoginUrl()
70
+	{
71
+		return get_bloginfo('url');
72
+	}
73
+
74
+	/**
75
+	 * @return string
76
+	 * @filter template_include
77
+	 */
78
+	public function filterTemplate($template)
79
+	{
80
+		if (is_string($template)) {
81
+			$template = Template::setLayout($template);
82
+			Development::storeTemplatePath($template);
83
+		}
84
+		return $template;
85
+	}
86
+
87
+	/**
88
+	 * @return array
89
+	 * @filter {$type}_template_hierarchy
90
+	 */
91
+	public function filterTemplateHierarchy(array $templates)
92
+	{
93
+		return array_map(function ($template) {
94
+			return Utility::startWith('templates/', $template);
95
+		}, $templates);
96
+	}
97
+
98
+	/**
99
+	 * @return void
100
+	 * @action admin_head
101
+	 * @action login_head
102
+	 */
103
+	public function loadAdminFavicon()
104
+	{
105
+		if (file_exists(Theme::assetPath('favicon/favicon-admin.ico'))) {
106
+			printf('<link rel="shortcut icon" href="%s">', Theme::assetUri('favicon/favicon-admin.ico'));
107
+		}
108
+	}
109
+
110
+	/**
111
+	 * @return void
112
+	 * @action login_head
113
+	 */
114
+	public function login()
115
+	{
116
+		if (file_exists(Theme::assetPath(castor_app()->cssDir.'login.css'))) {
117
+			printf('<link rel="stylesheet" href="%s">', Theme::assetUri(castor_app()->cssDir.'login.css'));
118
+		}
119
+	}
120
+
121
+	/**
122
+	 * @return void
123
+	 * @action admin_enqueue_scripts
124
+	 */
125
+	public function registerAdminAssets()
126
+	{
127
+		if (file_exists(Theme::assetPath(castor_app()->cssDir.'admin.css'))) {
128
+			wp_enqueue_style('castor/admin.css',
129
+				Theme::assetUri(castor_app()->cssDir.'admin.css'),
130
+				apply_filters('castor/enqueue/admin/css/deps', []),
131
+				CASTOR_FRAMEWORK_VERSION
132
+			);
133
+		}
134
+		if (file_exists(Theme::assetPath(castor_app()->jsDir.'admin.js'))) {
135
+			wp_enqueue_script('castor/admin.js',
136
+				Theme::assetUri(castor_app()->jsDir.'admin.js'),
137
+				apply_filters('castor/enqueue/admin/js/deps', []),
138
+				CASTOR_FRAMEWORK_VERSION,
139
+				true
140
+			);
141
+		}
142
+	}
143
+
144
+	/**
145
+	 * @return void
146
+	 * @action wp_enqueue_scripts
147
+	 */
148
+	public function registerAssets()
149
+	{
150
+		wp_register_style('castor/main.css',
151
+			Theme::assetUri(castor_app()->cssDir.'main.css'),
152
+			apply_filters('castor/enqueue/css/deps', []),
153
+			CASTOR_FRAMEWORK_VERSION
154
+		);
155
+		wp_register_script('castor/main.js',
156
+			Theme::assetUri(castor_app()->jsDir.'main.js'),
157
+			apply_filters('castor/enqueue/js/deps', []),
158
+			CASTOR_FRAMEWORK_VERSION,
159
+			true
160
+		);
161
+		wp_localize_script('castor/main.js', apply_filters('castor/enqueue/js/localize/variable', 'globals'),
162
+			apply_filters('castor/enqueue/js/localize/variables', [
163
+				'ajax' => admin_url('admin-ajax.php'),
164
+			])
165
+		);
166
+		do_action('castor/register/assets');
167
+		wp_enqueue_style('castor/main.css');
168
+		wp_enqueue_script('castor/main.js');
169
+	}
170
+
171
+	/**
172
+	 * @return void
173
+	 * @action customize_register
174
+	 */
175
+	public function registerCustomizer(WP_Customize_Manager $manager)
176
+	{
177
+		$manager->get_setting('blogname')->transport = 'postMessage';
178
+		$manager->selective_refresh->add_partial('blogname', [
179
+			'selector' => '.brand',
180
+			'render_callback' => function () {
181
+				bloginfo('name');
182
+			},
183
+		]);
184
+	}
185
+
186
+	/**
187
+	 * @return void
188
+	 * @action customize_preview_init
189
+	 */
190
+	public function registerCustomizerAssets()
191
+	{
192
+		wp_enqueue_script('castor/customizer.js', Theme::assetUri(castor_app()->jsDir.'customizer.js'), ['customize-preview'], CASTOR_FRAMEWORK_VERSION, true);
193
+	}
194
+
195
+	/**
196
+	 * @return void
197
+	 * @action widgets_init
198
+	 */
199
+	public function registerSidebars()
200
+	{
201
+		$defaults = apply_filters('castor/register/sidebars/defaults', [
202
+			'before_widget' => '<div class="widget %1$s %2$s">',
203
+			'after_widget' => '</div>',
204
+			'before_title' => '<h4>',
205
+			'after_title' => '</h4>',
206
+		]);
207
+
208
+		$sidebars = apply_filters('castor/register/sidebars', [
209
+			'sidebar-primary' => __('Primary Sidebar', 'castor'),
210
+			'sidebar-footer' => __('Footer Widgets', 'castor'),
211
+		]);
212
+
213
+		foreach ($sidebars as $id => $name) {
214
+			register_sidebar([
215
+				'id' => $id,
216
+				'name' => $name,
217
+			] + $defaults);
218
+		}
219
+	}
220 220
 }
Please login to merge, or discard this patch.