1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
/* Exit if accessed directly. */ |
4
|
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; } |
5
|
|
|
|
6
|
|
|
if ( ! class_exists( 'NarWidgets' ) ) { |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* NarWidgets class. |
10
|
|
|
*/ |
11
|
|
|
class NarWidgets { |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* __construct function. |
15
|
|
|
* |
16
|
|
|
* @access public |
17
|
|
|
* @return void |
|
|
|
|
18
|
|
|
*/ |
19
|
|
|
public function __construct() { |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Nar Iframe ID Names. |
25
|
|
|
* |
26
|
|
|
* @access public |
27
|
|
|
* @param string $iframe_id (default: '') |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function nar_iframe_id( $iframe_id = '' ) { |
31
|
|
|
|
32
|
|
|
if ( '' !== $iframe_id ) { |
33
|
|
|
return sanitize_html_class( $iframe_id ) . '-iframe'; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Nar Iframe Class Names. |
40
|
|
|
* |
41
|
|
|
* @access public |
42
|
|
|
* @param string $widget_name (default: '') |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
|
View Code Duplication |
public function nar_iframe_class( $widget_name = '' ) { |
|
|
|
|
46
|
|
|
|
47
|
|
|
if ( '' !== $widget_name ) { |
48
|
|
|
return 'nar nar-iframe nar-' . sanitize_html_class( $widget_name ) . '-iframe'; |
49
|
|
|
} else { |
50
|
|
|
return 'nar nar-iframe'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* get_mvp_program_widget function. |
57
|
|
|
* |
58
|
|
|
* @access public |
59
|
|
|
* @return void |
60
|
|
|
*/ |
61
|
|
|
public function get_mvp_program_widget() { |
62
|
|
|
|
63
|
|
|
echo '<iframe frameborder="0" id="'. nar_iframe_id() .'" class="'. $this->zillow_iframe_class( 'mvp-program' ) .'" title="'. __('NAR MVP Program.', 're-pro') .'" src="https://static.realtor.org/ro/widget/mvpwidget.html" scrolling="no" width="300" height="250"></iframe>'; |
|
|
|
|
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* get_home_ownership_matters_widget function. |
68
|
|
|
* |
69
|
|
|
* @access public |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function get_home_ownership_matters_widget() { |
73
|
|
|
|
74
|
|
|
// wp_enqueue_script( 'nar-message', 'http://www.realtor.org/sites/all/themes/rotheme/js/narmessage.js', 'jquery', null, true); |
|
|
|
|
75
|
|
|
|
76
|
|
|
echo '<iframe id="'. nar_iframe_id() .' class="'. $this->zillow_iframe_class( 'home-ownership-matters' ) .'" title="'. __('NAR Home Hownership Matters.', 're-pro') .'" src="https://www.realtor.org/sites/all/themes/rotheme/html/narmessage.html" frameborder="0" width="180" height="250" scrolling="no"></iframe></noscript>'; |
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* get_code_of_ethics_widget function. |
81
|
|
|
* |
82
|
|
|
* @access public |
83
|
|
|
* @return void |
84
|
|
|
*/ |
85
|
|
|
public function get_code_of_ethics_widget() { |
86
|
|
|
echo '<iframe id="'. nar_iframe_id() .' class="'. $this->zillow_iframe_class( 'code-of-ethics' ) .'" title="'. __('NAR Code of Ethics.', 're-pro') .'" frameborder="0" width="300" height="250" src="https://www.realtor.org/node/7504/embed" scrolling="no"></iframe>'; |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* get_nar_conf_expo_widget function. |
91
|
|
|
* |
92
|
|
|
* @access public |
93
|
|
|
* @return void |
94
|
|
|
*/ |
95
|
|
|
public function get_nar_conf_expo_widget() { |
96
|
|
|
echo '<iframe id="'. nar_iframe_id() .' class="'. $this->zillow_iframe_class( 'conference-expo' ) .'" title="'. __('NAR Conferences and Expos.', 're-pro') .'" frameborder="0" width="300" height="250" src="https://www.realtor.org/node/10695/embed" scrolling="no"></iframe>'; |
|
|
|
|
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.