@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | * Settings constructor. |
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | - if ( is_admin() ) { |
|
| 24 | + if (is_admin()) { |
|
| 25 | 25 | $this->general_settings = get_option('re_pro_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,27 +33,27 @@ discard block |
||
| 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( 're_pro_settings', 're_pro_settings' ); |
|
| 43 | + register_setting('re_pro_settings', 're_pro_settings'); |
|
| 44 | 44 | |
| 45 | 45 | // Feeds. |
| 46 | 46 | add_settings_section( |
| 47 | 47 | 're_pro_settings', |
| 48 | - __( 'General Settings', 're-pro' ), |
|
| 49 | - array( $this, 'general_callback' ), |
|
| 48 | + __('General Settings', 're-pro'), |
|
| 49 | + array($this, 'general_callback'), |
|
| 50 | 50 | 're_pro_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 | 're_pro_general_settings', |
| 58 | 58 | 're_pro_settings' |
| 59 | 59 | ); |
@@ -82,30 +82,30 @@ discard block |
||
| 82 | 82 | * Feed section callback. |
| 83 | 83 | */ |
| 84 | 84 | public function general_callback() { |
| 85 | - echo esc_attr( 'Activate the modules you would like to use.', 're-pro' ); |
|
| 85 | + echo esc_attr('Activate the modules you would like to use.', 're-pro'); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Render Christies field. |
| 90 | 90 | */ |
| 91 | 91 | public function google_maps() { |
| 92 | - $gmaps_active = isset( $this->general_settings['gmaps_active'] ) ? $this->general_settings['gmaps_active'] : '0'; |
|
| 93 | - $gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : ''; |
|
| 94 | - $gmaps_style = isset( $this->general_settings['gmaps_style'] ) ? $this->general_settings['gmaps_style'] : ''; |
|
| 92 | + $gmaps_active = isset($this->general_settings['gmaps_active']) ? $this->general_settings['gmaps_active'] : '0'; |
|
| 93 | + $gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : ''; |
|
| 94 | + $gmaps_style = isset($this->general_settings['gmaps_style']) ? $this->general_settings['gmaps_style'] : ''; |
|
| 95 | 95 | |
| 96 | - $checked = checked( '1', $gmaps_active, false ); |
|
| 97 | - $is_active = ( '1' === $gmaps_active ) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; |
|
| 96 | + $checked = checked('1', $gmaps_active, false); |
|
| 97 | + $is_active = ('1' === $gmaps_active) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; |
|
| 98 | 98 | |
| 99 | - echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_active]"' . esc_attr( $checked ) . ' value="1"> '; |
|
| 99 | + echo '<input style="vertical-align: top;" type="checkbox" name="re_pro_settings[gmaps_active]"' . esc_attr($checked) . ' value="1"> '; |
|
| 100 | 100 | echo '<div style="display: inline-block;">'; |
| 101 | - esc_attr_e( $is_active ); |
|
| 101 | + esc_attr_e($is_active); |
|
| 102 | 102 | echo '</div><br><br>'; |
| 103 | 103 | |
| 104 | 104 | echo '<input class="widefat" type="password" name="re_pro_settings[gmaps_key]" placeholder="Google maps API key" value="' . $gmaps_key . '">'; |
| 105 | 105 | echo '<span class="description"> Enter your google maps javascript api key</span><br><br>'; |
| 106 | 106 | |
| 107 | 107 | echo '<textarea style="width:500px;" rows="10" cols="50" name="re_pro_settings[gmaps_style]">'; |
| 108 | - esc_attr_e( $gmaps_style ); |
|
| 108 | + esc_attr_e($gmaps_style); |
|
| 109 | 109 | echo '</textarea>'; |
| 110 | 110 | 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 Maps</a> or the <a target="_blank" href="https://mapstyle.withgoogle.com/">Google Maps Styling Wizard</a></span>'; |
| 111 | 111 | } |
@@ -128,16 +128,16 @@ discard block |
||
| 128 | 128 | * Render full settings page. |
| 129 | 129 | */ |
| 130 | 130 | public function render_settings() { |
| 131 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 132 | - wp_die( esc_attr( "You don't have access to this page", 'imforza' ) ); |
|
| 131 | + if ( ! current_user_can('manage_options')) { |
|
| 132 | + wp_die(esc_attr("You don't have access to this page", 'imforza')); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | echo '<div class="wrap">'; |
| 136 | 136 | echo '<form method="post" action="options.php">'; |
| 137 | - echo '<h1>' . esc_attr( 'Real Estate Pro', 'imforza' ) . '</h1>'; |
|
| 137 | + echo '<h1>' . esc_attr('Real Estate Pro', 'imforza') . '</h1>'; |
|
| 138 | 138 | |
| 139 | - settings_fields( 're_pro_settings' ); |
|
| 140 | - do_settings_sections( 're_pro_general_settings' ); |
|
| 139 | + settings_fields('re_pro_settings'); |
|
| 140 | + do_settings_sections('re_pro_general_settings'); |
|
| 141 | 141 | submit_button(); |
| 142 | 142 | |
| 143 | 143 | echo '</form>'; |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | /* Exit if accessed directly. */ |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 9 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | // Google maps. |
| 14 | -include_once( 'modules/google-maps/gmaps.php' ); |
|
| 14 | +include_once('modules/google-maps/gmaps.php'); |
|
| 15 | 15 | |
| 16 | 16 | // Equal Housing. |
| 17 | -include_once( 'modules/equal-housing/equal-housing.php' ); |
|
| 17 | +include_once('modules/equal-housing/equal-housing.php'); |
|
| 18 | 18 | |
| 19 | 19 | // Zillow. |
| 20 | -include_once( 'modules/zillow/zillow.php' ); |
|
| 20 | +include_once('modules/zillow/zillow.php'); |
|
| 21 | 21 | |
| 22 | -include_once( 'modules/trulia/trulia.php' ); |
|
| 22 | +include_once('modules/trulia/trulia.php'); |
|
| 23 | 23 | |
| 24 | -include_once( 'modules/inman/inman.php' ); |
|
| 24 | +include_once('modules/inman/inman.php'); |
|
| 25 | 25 | |
| 26 | -include_once( 'modules/homes-com/homes-com.php' ); |
|
| 26 | +include_once('modules/homes-com/homes-com.php'); |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | -include_once( 'modules/streetadvisor/streetadvisor.php' ); |
|
| 29 | +include_once('modules/streetadvisor/streetadvisor.php'); |
|
| 30 | 30 | |
| 31 | -include_once( 'modules/greatschools/greatschools.php' ); |
|
| 31 | +include_once('modules/greatschools/greatschools.php'); |
|