Conditions | 1 |
Paths | 1 |
Total Lines | 84 |
Code Lines | 51 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
124 | function render_notice_first_step() { ?> |
||
125 | <div class="jp-idc-notice__first-step"> |
||
126 | <div class="jp-idc-notice__content-header"> |
||
127 | <h3 class="jp-idc-notice__content-header__lead"> |
||
128 | <?php |
||
129 | echo wp_kses( |
||
130 | sprintf( |
||
131 | __( |
||
132 | 'Jetpack has been placed into <a href="%1$s">Safe mode</a> because we noticed this is an exact copy of <a href="%2$s">%3$s</a>.', |
||
133 | 'jetpack' |
||
134 | ), |
||
135 | esc_url( self::SAFE_MODE_DOC_LINK ), |
||
136 | esc_url( self::$wpcom_home_url ), |
||
137 | self::prepare_url_for_display( esc_url_raw( self::$wpcom_home_url ) ) |
||
138 | ), |
||
139 | array( 'a' => array( 'href' => array() ) ) |
||
140 | ); |
||
141 | ?> |
||
142 | </h3> |
||
143 | |||
144 | <p class="jp-idc-notice__content-header__explanation"> |
||
145 | <?php |
||
146 | echo wp_kses( |
||
147 | sprintf( |
||
148 | __( |
||
149 | 'Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or <a href="%1$s">learn |
||
150 | more about Safe Mode</a>.', |
||
151 | 'jetpack' |
||
152 | ), |
||
153 | esc_url( self::SAFE_MODE_DOC_LINK ) |
||
154 | ), |
||
155 | array( 'a' => array( 'href' => array() ) ) |
||
156 | ); |
||
157 | ?> |
||
158 | </p> |
||
159 | </div> |
||
160 | |||
161 | <div class="jp-idc-notice__actions"> |
||
162 | <div class="jp-idc-notice__action"> |
||
163 | <p class="jp-idc-notice__action__explanation"> |
||
164 | <?php |
||
165 | echo wp_kses( |
||
166 | sprintf( |
||
167 | __( |
||
168 | 'Is this website a temporary duplicate of <a href="%1$s">%2$s</a> for the purposes |
||
169 | of testing, staging or development? If so, we recommend keeping it in Safe Mode.', |
||
170 | 'jetpack' |
||
171 | ), |
||
172 | esc_url( untrailingslashit( self::$wpcom_home_url ) ), |
||
173 | self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) ) |
||
174 | ), |
||
175 | array( 'a' => array( 'href' => array() ) ) |
||
176 | ); |
||
177 | ?> |
||
178 | </p> |
||
179 | <button id="jp-idc-confirm-safe-mode-action" class="dops-button"> |
||
180 | <?php esc_html_e( 'Confirm Safe Mode' ); ?> |
||
181 | </button> |
||
182 | </div> |
||
183 | |||
184 | <div class="jp-idc-notice__action"> |
||
185 | <p class="jp-idc-notice__action__explanation"> |
||
186 | <?php |
||
187 | echo wp_kses( |
||
188 | sprintf( |
||
189 | __( |
||
190 | 'If this is a separate and new website, or the new home of <a href="%1$s">%2$s</a>, |
||
191 | we recommend turning Safe Mode off, and re-establishing your connection to WordPress.com.', |
||
192 | 'jetpack' |
||
193 | ), |
||
194 | esc_url( untrailingslashit( self::$wpcom_home_url ) ), |
||
195 | self::prepare_url_for_display( esc_url( self::$wpcom_home_url ) ) |
||
196 | ), |
||
197 | array( 'a' => array( 'href' => array() ) ) |
||
198 | ); |
||
199 | ?> |
||
200 | </p> |
||
201 | <button id="jp-idc-fix-connection-action" class="dops-button"> |
||
202 | <?php esc_html_e( "Fix Jetpack's Connection" ); ?> |
||
203 | </button> |
||
204 | </div> |
||
205 | </div> |
||
206 | </div> |
||
207 | <?php } |
||
208 | |||
296 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.