Test Failed
Push — master ( e7e244...c2c5e3 )
by Brandon
08:13 queued 05:51
created
settings.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 * Settings constructor.
22 22
 	 */
23 23
 	public function __construct() {
24
-		if ( is_admin() ) {
25
-			$this->general_settings = get_option( 'repro_settings' );
24
+		if (is_admin()) {
25
+			$this->general_settings = get_option('repro_settings');
26 26
 
27
-			add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
28
-			add_action( 'admin_init', array( $this, 'settings_init' ) );
27
+			add_action('admin_menu', array($this, 'add_admin_menu'));
28
+			add_action('admin_init', array($this, 'settings_init'));
29 29
 		}
30 30
 	}
31 31
 
@@ -33,51 +33,51 @@  discard block
 block discarded – undo
33 33
 	 * Add admin menu.
34 34
 	 */
35 35
 	public function add_admin_menu() {
36
-		add_options_page( __( 'Real Estate Pro' ), __( 'Real Estate Pro' ), 'manage_options', 're-pro-settings', array( $this, 'render_settings' ) );
36
+		add_options_page(__('Real Estate Pro'), __('Real Estate Pro'), 'manage_options', 're-pro-settings', array($this, 'render_settings'));
37 37
 	}
38 38
 
39 39
 	/**
40 40
 	 * Initialize settings fields and sections.
41 41
 	 */
42 42
 	public function settings_init() {
43
-		register_setting( 'repro_settings', 'repro_settings' );
43
+		register_setting('repro_settings', 'repro_settings');
44 44
 
45 45
 		// General Settings.
46 46
 		add_settings_section(
47 47
 			'repro_settings',
48
-			__( 'General Settings', 're-pro' ),
49
-			array( $this, 'general_callback' ),
48
+			__('General Settings', 're-pro'),
49
+			array($this, 'general_callback'),
50 50
 			'repro_general_settings'
51 51
 		);
52 52
 
53 53
 		add_settings_field(
54 54
 			'google_maps',
55
-			__( 'Google Maps Module', 're-pro' ),
56
-			array( $this, 'google_maps' ),
55
+			__('Google Maps Module', 're-pro'),
56
+			array($this, 'google_maps'),
57 57
 			'repro_general_settings',
58 58
 			'repro_settings'
59 59
 		);
60 60
 
61 61
 		add_settings_field(
62 62
 			'greatschools_apikey',
63
-			__( 'Great Schools API Key', 're-pro' ),
64
-			array( $this, 'greatschools_module' ),
63
+			__('Great Schools API Key', 're-pro'),
64
+			array($this, 'greatschools_module'),
65 65
 			'repro_general_settings',
66 66
 			'repro_settings'
67 67
 		);
68 68
 
69 69
 		add_settings_field(
70 70
 			'zillow_apikey',
71
-			__( 'Zillow API Key', 're-pro' ),
72
-			array( $this, 'zillow_module' ),
71
+			__('Zillow API Key', 're-pro'),
72
+			array($this, 'zillow_module'),
73 73
 			'repro_general_settings',
74 74
 			'repro_settings'
75 75
 		);
76 76
 
77 77
 		add_settings_field(
78 78
 			'sa_apikey',
79
-			__( 'Street Advisor API Key', 're-pro' ),
80
-			array( $this, 'street_advisor' ),
79
+			__('Street Advisor API Key', 're-pro'),
80
+			array($this, 'street_advisor'),
81 81
 			'repro_general_settings',
82 82
 			'repro_settings'
83 83
 		);
@@ -88,36 +88,36 @@  discard block
 block discarded – undo
88 88
 	 * Feed section callback.
89 89
 	 */
90 90
 	public function general_callback() {
91
-		echo esc_attr( 'Activate the modules you would like to use.', 're-pro' );
91
+		echo esc_attr('Activate the modules you would like to use.', 're-pro');
92 92
 	}
93 93
 
94 94
 	/**
95 95
 	 * Render Christies field.
96 96
 	 */
97 97
 	public function google_maps() {
98
-		$gmaps_active = isset( $this->general_settings['gmaps_active'] ) ? $this->general_settings['gmaps_active'] : '0';
99
-		$gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : '';
100
-		$gmaps_style = isset( $this->general_settings['gmaps_style'] ) ? $this->general_settings['gmaps_style'] : '';
101
-		$gmaps_zoom = isset( $this->general_settings['gmaps_zoom'] ) ? $this->general_settings['gmaps_zoom'] : '';
98
+		$gmaps_active = isset($this->general_settings['gmaps_active']) ? $this->general_settings['gmaps_active'] : '0';
99
+		$gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : '';
100
+		$gmaps_style = isset($this->general_settings['gmaps_style']) ? $this->general_settings['gmaps_style'] : '';
101
+		$gmaps_zoom = isset($this->general_settings['gmaps_zoom']) ? $this->general_settings['gmaps_zoom'] : '';
102 102
 
103
-		$checked = checked( '1', $gmaps_active, false );
104
-		$is_active = ( '1' === $gmaps_active ) ? 'Deactivate Google maps module?' : 'Activate Google maps module?';
105
-		$disable_zoom = checked( '1', $gmaps_zoom, false );
103
+		$checked = checked('1', $gmaps_active, false);
104
+		$is_active = ('1' === $gmaps_active) ? 'Deactivate Google maps module?' : 'Activate Google maps module?';
105
+		$disable_zoom = checked('1', $gmaps_zoom, false);
106 106
 
107
-		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_active]"' . esc_attr( $checked ) . ' value="1"> ';
107
+		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_active]"' . esc_attr($checked) . ' value="1"> ';
108 108
 		echo '<div style="display: inline-block;">';
109
-		esc_attr_e( $is_active );
109
+		esc_attr_e($is_active);
110 110
 		echo '</div><br><br>';
111 111
 
112 112
 		echo '<input class="widefat" type="password" name="repro_settings[gmaps_key]" placeholder="Google maps API key" value="' . $gmaps_key . '">';
113 113
 		echo '<span class="description"> Enter your google maps javascript api key</span><br><br>';
114 114
 
115 115
 		echo '<textarea style="width:500px;" rows="10" cols="50" name="repro_settings[gmaps_style]">';
116
-		esc_attr_e( $gmaps_style );
116
+		esc_attr_e($gmaps_style);
117 117
 		echo '</textarea>';
118 118
 		echo '<br /><span class="description">Insert valid json to add custom style to maps. Json styles can be generated using <a target="_blank" href="https://snazzymaps.com/">Snazzy&nbsp;Maps</a> or the <a target="_blank" href="https://mapstyle.withgoogle.com/">Google&nbsp;Maps&nbsp;Styling&nbsp;Wizard</a></span><br><br>';
119 119
 
120
-		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_zoom]"' . esc_attr( $disable_zoom ) . ' value="1"> ';
120
+		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_zoom]"' . esc_attr($disable_zoom) . ' value="1"> ';
121 121
 		echo '<div style="display: inline-block;">';
122 122
 		echo 'Disable scroll zoom in Google Maps';
123 123
 		echo '</div>';
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	public function zillow_module() {
128 128
 
129
-		$zillow_apikey = isset( $this->general_settings['zillow_apikey'] ) ? $this->general_settings['zillow_apikey'] : '';
129
+		$zillow_apikey = isset($this->general_settings['zillow_apikey']) ? $this->general_settings['zillow_apikey'] : '';
130 130
 
131 131
 		echo '<input class="widefat" type="text" name="repro_settings[zillow_apikey]" placeholder="Zillow API Key" value="' . $zillow_apikey . '">';
132 132
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 	public function street_advisor() {
136 136
 
137
-		$sa_apikey = isset( $this->general_settings['sa_apikey'] ) ? $this->general_settings['sa_apikey'] : '';
137
+		$sa_apikey = isset($this->general_settings['sa_apikey']) ? $this->general_settings['sa_apikey'] : '';
138 138
 
139 139
 		echo '<input class="widefat" type="text" name="repro_settings[sa_apikey]" placeholder="Street Advisor API Key" value="' . $sa_apikey . '">';
140 140
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function greatschools_module() {
150 150
 
151
-		$greatschools_apikey = isset( $this->general_settings['greatschools_apikey'] ) ? $this->general_settings['greatschools_apikey'] : '';
151
+		$greatschools_apikey = isset($this->general_settings['greatschools_apikey']) ? $this->general_settings['greatschools_apikey'] : '';
152 152
 
153 153
 		echo '<input class="widefat" type="text" name="repro_settings[greatschools_apikey]" placeholder="Great Schools API Key" value="' . $greatschools_apikey . '">';
154 154
 
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 * Render full settings page.
159 159
 	 */
160 160
 	public function render_settings() {
161
-		if ( ! current_user_can( 'manage_options' ) ) {
162
-			wp_die( esc_attr( "You don't have access to this page", 're-pro' ) );
161
+		if ( ! current_user_can('manage_options')) {
162
+			wp_die(esc_attr("You don't have access to this page", 're-pro'));
163 163
 		}
164 164
 
165 165
 		echo '<div class="wrap">';
166 166
 		echo '<form method="post" action="options.php">';
167
-		echo '<h1>' . esc_attr( 'Real Estate Pro', 're-pro' ) . '</h1>';
167
+		echo '<h1>' . esc_attr('Real Estate Pro', 're-pro') . '</h1>';
168 168
 
169
-		settings_fields( 'repro_settings' );
170
-		do_settings_sections( 'repro_general_settings' );
169
+		settings_fields('repro_settings');
170
+		do_settings_sections('repro_general_settings');
171 171
 		submit_button();
172 172
 
173 173
 		echo '</form>';
Please login to merge, or discard this patch.
re-pro.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 */
22 22
 
23 23
 /* Exit if accessed directly. */
24
-if ( ! defined( 'ABSPATH' ) ) { exit; }
24
+if ( ! defined('ABSPATH')) { exit; }
25 25
 
26 26
 /** Instantiate the plugin. */
27 27
 new RePro();
28
-require_once( 'settings.php' );
28
+require_once('settings.php');
29 29
 
30 30
 
31 31
 /**
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct() {
43 43
 		/* Define Constants */
44
-		define( 'REPRO_BASE_NAME', plugin_basename( __FILE__ ) );
45
-		define( 'REPRO_BASE_DIR', plugin_dir_path( __FILE__ ) );
46
-		define( 'REPRO_PLUGIN_FILE', REPRO_BASE_DIR . 're-pro.php' );
44
+		define('REPRO_BASE_NAME', plugin_basename(__FILE__));
45
+		define('REPRO_BASE_DIR', plugin_dir_path(__FILE__));
46
+		define('REPRO_PLUGIN_FILE', REPRO_BASE_DIR . 're-pro.php');
47 47
 
48 48
 		/* Include dependencies */
49
-		require_once( 'includes.php' );
49
+		require_once('includes.php');
50 50
 
51 51
 		$this->init();
52 52
 	}
@@ -59,48 +59,48 @@  discard block
 block discarded – undo
59 59
 	 * @return void
60 60
 	 */
61 61
 	private function init() {
62
-		$this->general_settings = get_option( 're_pro_settings' );
62
+		$this->general_settings = get_option('re_pro_settings');
63 63
 
64 64
 		/* Language Support. */
65
-		load_plugin_textdomain( 're-pro', false, dirname( REPRO_BASE_NAME ) . '/languages' );
65
+		load_plugin_textdomain('re-pro', false, dirname(REPRO_BASE_NAME) . '/languages');
66 66
 
67 67
 		/* Plugin Activation/De-Activation. */
68
-		register_activation_hook( REPRO_PLUGIN_FILE, array( $this, 'activate' ) );
69
-		register_deactivation_hook( REPRO_PLUGIN_FILE, array( $this, 'deactivate' ) );
68
+		register_activation_hook(REPRO_PLUGIN_FILE, array($this, 'activate'));
69
+		register_deactivation_hook(REPRO_PLUGIN_FILE, array($this, 'deactivate'));
70 70
 
71 71
 		/* Set menu page. */
72
-		add_action( 'admin_menu', array( $this, 'admin_menu' ) );
72
+		add_action('admin_menu', array($this, 'admin_menu'));
73 73
 
74 74
 		/** Enqueue css and js files. */
75
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
76
-		add_action( 'wp_enqueue_scripts', 	 array( $this, 'widget_styles' ) );
75
+		add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
76
+		add_action('wp_enqueue_scripts', array($this, 'widget_styles'));
77 77
 
78 78
 		/* Add link to settings in plugins admin page. */
79
-		add_filter( 'plugin_action_links_' . REPRO_BASE_NAME , array( $this, 'plugin_links' ) );
79
+		add_filter('plugin_action_links_' . REPRO_BASE_NAME, array($this, 'plugin_links'));
80 80
 
81
-		add_filter( 'wpapi_google_map_data', array( $this, 'gmap_style' ), 1 );
81
+		add_filter('wpapi_google_map_data', array($this, 'gmap_style'), 1);
82 82
 
83 83
 		$this->init_modules();
84 84
 	}
85 85
 
86 86
 	private function init_modules() {
87
-		$gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : null;
87
+		$gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : null;
88 88
 
89
-		if ( isset( $this->general_settings['gmaps_active'] ) && isset( $gmaps_key ) ) {
90
-			new WPAPI_GOOGLE_MAPS( $gmaps_key );
89
+		if (isset($this->general_settings['gmaps_active']) && isset($gmaps_key)) {
90
+			new WPAPI_GOOGLE_MAPS($gmaps_key);
91 91
 		}
92 92
 	}
93 93
 
94
-	public function gmap_style( $map_data ) {
94
+	public function gmap_style($map_data) {
95 95
 		// Grab style option.
96
-		$map_json = ( isset( $this->general_settings['gmaps_style'] ) ) ? $this->general_settings['gmaps_style'] : '[]';
96
+		$map_json = (isset($this->general_settings['gmaps_style'])) ? $this->general_settings['gmaps_style'] : '[]';
97 97
 
98 98
 		// Validate JSON.
99
-		json_decode( $map_json );
99
+		json_decode($map_json);
100 100
 		$json_valid = json_last_error();
101 101
 
102 102
 		// Set style to map_data.
103
-		$map_data['style'] = ( $json_valid === JSON_ERROR_NONE ) ? $map_json : '[]';
103
+		$map_data['style'] = ($json_valid === JSON_ERROR_NONE) ? $map_json : '[]';
104 104
 
105 105
 		return $map_data;
106 106
 	}
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * Enqueue CSS.
117 117
 	 */
118 118
 	public function admin_scripts() {
119
-		if ( ! is_admin() ) {
120
-			wp_register_style( 're-pro', plugins_url( 'assets/css/re-pro-min.css', REPRO_PLUGIN_FILE ) );
119
+		if ( ! is_admin()) {
120
+			wp_register_style('re-pro', plugins_url('assets/css/re-pro-min.css', REPRO_PLUGIN_FILE));
121 121
 			// wp_enqueue_style( 're-pro' );
122 122
 		}
123 123
 	}
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * Register Widget CSS.
127 127
 	 */
128 128
 	public function widget_styles() {
129
-		wp_register_style( 're-pro-widgets', plugins_url( 'assets/css/re-pro-widgets.min.css', REPRO_PLUGIN_FILE ) );
130
-		wp_enqueue_style( 're-pro-widgets' );
129
+		wp_register_style('re-pro-widgets', plugins_url('assets/css/re-pro-widgets.min.css', REPRO_PLUGIN_FILE));
130
+		wp_enqueue_style('re-pro-widgets');
131 131
 	}
132 132
 
133 133
 	/**
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
 	 * @param  [Array] $links : Array of links on plugin page.
151 151
 	 * @return [Array]        : Array of links on plugin page.
152 152
 	 */
153
-	public function plugin_links( $links ) {
153
+	public function plugin_links($links) {
154 154
 		$settings_link = '<a href="options-general.php?page=re-pro-settings">Settings</a>';
155
-		array_unshift( $links, $settings_link );
155
+		array_unshift($links, $settings_link);
156 156
 		return $links;
157 157
 	}
158 158
 }
Please login to merge, or discard this patch.