Passed
Pull Request — master (#3)
by Joseph
96:53 queued 54:53
created
shortcodes/subway-shortcodes.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 namespace Subway;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	return;
16 16
 }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	private function __construct() {
21 21
 		
22
-		add_action( 'init', array( $this, 'register') );
22
+		add_action('init', array($this, 'register'));
23 23
 		
24 24
 		return $this;
25 25
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		
30 30
 		static $instance = null;
31 31
 
32
-		if ( null === $instance ) {
32
+		if (null === $instance) {
33 33
 
34 34
 			$instance = new Shortcodes();
35 35
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 
43 43
 	function register() {
44 44
 
45
-		add_shortcode( 'subway_login', array( $this, 'wp_login' ) );
45
+		add_shortcode('subway_login', array($this, 'wp_login'));
46 46
 
47
-		add_action( 'login_form_middle', array( $this, 'login_form_action' ), 10, 2 );
47
+		add_action('login_form_middle', array($this, 'login_form_action'), 10, 2);
48 48
 
49
-		add_action( 'login_form_middle', array( $this, '__action_lost_password_link' ), 10, 2 );
49
+		add_action('login_form_middle', array($this, '__action_lost_password_link'), 10, 2);
50 50
 
51 51
 		return null;
52 52
 
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 		
57 57
 		$atts = array();
58 58
 
59
-		echo $this->get_template_file( $atts, $file = 'login-form.php', $content = null );
59
+		echo $this->get_template_file($atts, $file = 'login-form.php', $content = null);
60 60
 
61 61
 		return;
62 62
 	}
63 63
 
64
-	protected function get_template_file( $atts, $file = '', $content = null ) {
64
+	protected function get_template_file($atts, $file = '', $content = null) {
65 65
 
66 66
 		ob_start();
67 67
 
68
-		if ( empty( $file ) ) {
68
+		if (empty($file)) {
69 69
 			
70 70
 			return;
71 71
 
72 72
 		}
73 73
 
74
-		$template = SUBWAY_DIR_PATH . 'templates/'.$file;
74
+		$template = SUBWAY_DIR_PATH . 'templates/' . $file;
75 75
 
76
-		if ( file_exists( $template ) ) {
76
+		if (file_exists($template)) {
77 77
 
78
-			if ( $theme_template = locate_template( array('gears/shortcodes/'.$file ) ) ) {
78
+			if ($theme_template = locate_template(array('gears/shortcodes/' . $file))) {
79 79
 
80 80
 	        	$template = $theme_template;
81 81
 
@@ -85,26 +85,26 @@  discard block
 block discarded – undo
85 85
 
86 86
     	} else {
87 87
 
88
-	    	echo sprintf( esc_html_e( 'Subway Error: Unable to find template file in: %1s', 'subway' ), $template );
88
+	    	echo sprintf(esc_html_e('Subway Error: Unable to find template file in: %1s', 'subway'), $template);
89 89
 
90 90
 	    }
91 91
 
92 92
 	    return ob_get_clean();
93 93
 	}
94 94
 
95
-	public function login_form_action( $__content ) {
95
+	public function login_form_action($__content) {
96 96
 
97 97
 		ob_start();
98 98
 		
99
-		do_action( 'login_form' );
99
+		do_action('login_form');
100 100
 		
101 101
 		return $__content . ob_get_clean();
102 102
 
103 103
 	}
104 104
 
105
-	public function __action_lost_password_link( $__content ) {
105
+	public function __action_lost_password_link($__content) {
106 106
 		
107
-		return $__content . $this->get_template_file( $params = array(),  $file = 'login-form-lost-password.php',  $content = null );
107
+		return $__content . $this->get_template_file($params = array(), $file = 'login-form-lost-password.php', $content = null);
108 108
 
109 109
 	}
110 110
 
Please login to merge, or discard this patch.
classes/subway-enqueue.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 namespace Subway;
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
    return;
16 16
 }
17 17
 
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	
20 20
 	public static function register_js() {
21 21
 
22
-   		wp_enqueue_style( 'subway-style', SUBWAY_DIR_URL . 'assets/css/subway.css' );
22
+   		wp_enqueue_style('subway-style', SUBWAY_DIR_URL . 'assets/css/subway.css');
23 23
 
24
-   		wp_enqueue_script( 'subway-script', SUBWAY_DIR_URL . 'assets/js/subway.js', array('jquery') );
24
+   		wp_enqueue_script('subway-script', SUBWAY_DIR_URL . 'assets/js/subway.js', array('jquery'));
25 25
 
26
-   		wp_localize_script( 'subway-script', 'subway_config', array( 
27
-   				'ajax_url' => admin_url( 'admin-ajax.php' ),
28
-   				'login_http_error' => esc_html__( 'An error occured while transmitting the data. Refresh the page and try again', 'subway' )
26
+   		wp_localize_script('subway-script', 'subway_config', array( 
27
+   				'ajax_url' => admin_url('admin-ajax.php'),
28
+   				'login_http_error' => esc_html__('An error occured while transmitting the data. Refresh the page and try again', 'subway')
29 29
    			)
30 30
    		);
31 31
 
Please login to merge, or discard this patch.
i18.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 /**
18 18
  * Plugin i18n.
19 19
  */
20
-add_action( 'plugins_loaded', 'subway_localize_plugin' );
20
+add_action('plugins_loaded', 'subway_localize_plugin');
21 21
 
22 22
 /**
23 23
  * Subway l10n callback.
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	$rel_path = SUBWAY_DIR_PATH . 'languages';
30 30
 
31
-	load_plugin_textdomain( 'subway', false, $rel_path );
31
+	load_plugin_textdomain('subway', false, $rel_path);
32 32
 
33 33
 	return;
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
templates/login-form-lost-password.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 ?>
17 17
 <p class="subway-login-lost-password">
18
-	<a href="<?php echo esc_url( wp_lostpassword_url( $redirect = '' ) ); ?>">
19
-	 	<?php esc_html_e( 'Forgot Password', 'subway' ); ?>
18
+	<a href="<?php echo esc_url(wp_lostpassword_url($redirect = '')); ?>">
19
+	 	<?php esc_html_e('Forgot Password', 'subway'); ?>
20 20
 	</a>
21 21
 </p>
Please login to merge, or discard this patch.
admin-settings.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
     return;
15 15
 }
16 16
 
17
-add_action( 'admin_menu', 'subway_admin_menu' );
17
+add_action('admin_menu', 'subway_admin_menu');
18 18
 
19
-add_action( 'admin_init', 'subway_register_settings' );
19
+add_action('admin_init', 'subway_register_settings');
20 20
 
21 21
 /**
22 22
  * Display 'Subway' link under 'Settings'
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function subway_admin_menu() {
26 26
     
27
-    add_options_page( 'Subway Settings', 'Subway', 'manage_options', 'subway', 'subway_options_page' );
27
+    add_options_page('Subway Settings', 'Subway', 'manage_options', 'subway', 'subway_options_page');
28 28
 
29 29
     return;
30 30
 }
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 function subway_register_settings() {
34 34
 
35 35
 	// Register our settings section.
36
-	add_settings_section( 'subway-page-visibility-section', __( 'Pages Visibility', 'subway' ), 'subway_section_cb', 'subway-settings-section' );
36
+	add_settings_section('subway-page-visibility-section', __('Pages Visibility', 'subway'), 'subway_section_cb', 'subway-settings-section');
37 37
 
38 38
     // Register Redirect Options pages.
39
-	add_settings_section( 'subway-redirect-section', __( 'Redirect Options', 'subway' ), 'subway_redirect_cb', 'subway-settings-section' );
39
+	add_settings_section('subway-redirect-section', __('Redirect Options', 'subway'), 'subway_redirect_cb', 'subway-settings-section');
40 40
 
41 41
 	// Register the fields.
42 42
     $fields = array(
43 43
     		array(
44 44
     				'id' => 'subway_is_public',
45
-    				'label' => __( 'Public Website', 'subway' ),
45
+    				'label' => __('Public Website', 'subway'),
46 46
     				'callback' => 'subway_is_public_form',
47 47
     				'section' => 'subway-settings-section',
48 48
     				'group' => 'subway-page-visibility-section'
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
     		
51 51
     		array(
52 52
     				'id' => 'subway_login_page',
53
-    				'label' => __( 'Private Login Page', 'subway' ),
53
+    				'label' => __('Private Login Page', 'subway'),
54 54
     				'callback' => 'subway_login_page_form',
55 55
     				'section' => 'subway-settings-section',
56 56
     				'group' => 'subway-page-visibility-section'
57 57
     			),
58 58
     		array(
59 59
     				'id' => 'subway_public_post',
60
-    				'label' => __( 'Public Posts IDs', 'subway' ),
60
+    				'label' => __('Public Posts IDs', 'subway'),
61 61
     				'callback' => 'subway_public_post',
62 62
     				'section' => 'subway-settings-section',
63 63
     				'group' => 'subway-page-visibility-section'
@@ -65,32 +65,32 @@  discard block
 block discarded – undo
65 65
     	
66 66
     		array(
67 67
     				'id' => 'subway_redirect_type',
68
-    				'label' => __( 'Redirect Type', 'subway' ),
68
+    				'label' => __('Redirect Type', 'subway'),
69 69
     				'callback' => 'subway_redirect_option_form',
70 70
     				'section' => 'subway-settings-section',
71 71
     				'group' => 'subway-redirect-section'
72 72
     			),
73 73
     		array(
74 74
     				'id' => 'subway_redirect_wp_admin',
75
-    				'label' => __( 'Block <em>wp-admin</em> Access', 'subway' ),
75
+    				'label' => __('Block <em>wp-admin</em> Access', 'subway'),
76 76
     				'callback' => 'subway_lock_wp_admin',
77 77
     				'section' => 'subway-settings-section',
78 78
     				'group' => 'subway-redirect-section'
79 79
     			),
80 80
     	);
81 81
 
82
-    foreach( $fields as $field ) {
82
+    foreach ($fields as $field) {
83 83
 
84
-    	add_settings_field( $field['id'], $field['label'], $field['callback'], $field['section'], $field['group'] );
85
-    	register_setting( 'subway-settings-group', $field['id'] );
86
-    	require_once trailingslashit( SUBWAY_DIR_PATH ) . 'settings-fields/field-' . sanitize_title( str_replace('_','-', $field['callback']) ) . '.php';
84
+    	add_settings_field($field['id'], $field['label'], $field['callback'], $field['section'], $field['group']);
85
+    	register_setting('subway-settings-group', $field['id']);
86
+    	require_once trailingslashit(SUBWAY_DIR_PATH) . 'settings-fields/field-' . sanitize_title(str_replace('_', '-', $field['callback'])) . '.php';
87 87
     }
88 88
 
89 89
     // Register Redirect Page ID Settings.
90
-	register_setting( 'subway-settings-group', 'subway_redirect_page_id' );
90
+	register_setting('subway-settings-group', 'subway_redirect_page_id');
91 91
 
92 92
     // Register Redirect Custom URL Settings.
93
-	register_setting( 'subway-settings-group', 'subway_redirect_custom_url' );
93
+	register_setting('subway-settings-group', 'subway_redirect_custom_url');
94 94
 
95 95
     return;
96 96
 }
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
         	<?php esc_html_e('Subway Settings', 'subway'); ?>
111 111
         </h2>
112 112
         <form id="subway-settings-form" action="options.php" method="POST">
113
-            <?php settings_fields( 'subway-settings-group' ); ?>
114
-            <?php do_settings_sections( 'subway-settings-section' ); ?>
113
+            <?php settings_fields('subway-settings-group'); ?>
114
+            <?php do_settings_sections('subway-settings-section'); ?>
115 115
             <?php submit_button(); ?>
116 116
         </form>
117 117
     </div>
Please login to merge, or discard this patch.
settings-fields/field-subway-login-page-form.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @package Subway
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	return;
15 15
 }
16 16
 
@@ -21,24 +21,24 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function subway_login_page_form() {
23 23
 
24
-	$subway_login_page_id = intval( get_option( 'subway_login_page' ) );
24
+	$subway_login_page_id = intval(get_option('subway_login_page'));
25 25
 
26
-	if ( ! empty( $subway_login_page_id ) ) {
26
+	if ( ! empty($subway_login_page_id)) {
27 27
 
28
-		$login_page_object = get_post( $subway_login_page_id );
28
+		$login_page_object = get_post($subway_login_page_id);
29 29
 
30
-		if ( ! empty( $login_page_object )  && isset( $login_page_object->post_content ) ) {
30
+		if ( ! empty($login_page_object) && isset($login_page_object->post_content)) {
31 31
 
32 32
 			// Automatically prepend the login shortcode if no
33 33
 			// Shortcode exists in the selected login page.
34
-			if ( ! has_shortcode( $login_page_object->post_content, 'subway_login' ) ) {
34
+			if ( ! has_shortcode($login_page_object->post_content, 'subway_login')) {
35 35
 
36 36
 				$new_post_object = array(
37 37
 				  'ID' => $login_page_object->ID,
38
-				  'post_content' => '[subway_login] ' . $login_page_object->post_content,// Prepend Only.
38
+				  'post_content' => '[subway_login] ' . $login_page_object->post_content, // Prepend Only.
39 39
 				 );
40 40
 
41
-				wp_update_post( $new_post_object );
41
+				wp_update_post($new_post_object);
42 42
 			}
43 43
 		}
44 44
 	}
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	wp_dropdown_pages(
47 47
 		array(
48 48
 		'name' => 'subway_login_page',
49
-		'selected' => intval( $subway_login_page_id ),
50
-		'show_option_none' => esc_html__( '---', 'subway' ),
49
+		'selected' => intval($subway_login_page_id),
50
+		'show_option_none' => esc_html__('---', 'subway'),
51 51
 		)
52 52
 	);
53 53
 
54
-	echo '<p class="description">' . sprintf( esc_html__( 'Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway' ), '<span style="font-weight: bold; color: #ad4a4a;">' . esc_html__( 'You need to add "[subway_login]" shortcode in the selected page to show the login form (this is done automatically)', 'subway' ) ) . '</span></p>';
54
+	echo '<p class="description">' . sprintf(esc_html__('Select a login page and save the changes to make your site private. Leave blank to make your site public. %1$s.', 'subway'), '<span style="font-weight: bold; color: #ad4a4a;">' . esc_html__('You need to add "[subway_login]" shortcode in the selected page to show the login form (this is done automatically)', 'subway')) . '</span></p>';
55 55
 
56 56
 	return;
57 57
 }
Please login to merge, or discard this patch.