| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 36 |
| 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 |
||
| 53 | function idc_notice_step_one() { |
||
| 54 | $safe_mode_doc_link = 'https://jetpack.com/support/safe-mode'; |
||
| 55 | $old_url = esc_url( self::$wpcom_home_url ); |
||
| 56 | ?> |
||
| 57 | <div class="jp-idc notice notice-warning"> |
||
| 58 | <div class="jp-emblem"> |
||
| 59 | <?php echo Jetpack::get_jp_emblem(); ?> |
||
| 60 | </div> |
||
| 61 | <p class="msg-top"> |
||
| 62 | <?php esc_html_e( 'Jetpack Safe Mode.', 'jetpack' ); ?> |
||
| 63 | </p> |
||
| 64 | <hr /> |
||
| 65 | <div class="msg-bottom-head"> |
||
| 66 | <?php |
||
| 67 | _e( |
||
| 68 | sprintf( |
||
| 69 | 'Jetpack has been placed into %1$sSafe Mode%2$s because we noticed this is an exact copy of %3$s. |
||
| 70 | Please confirm Safe Mode or fix the Jetpack connection. Select one of the options below or %1$slearn more about Safe Mode%2$s.', |
||
| 71 | '<a href="' . esc_url( $safe_mode_doc_link ) . '">', |
||
| 72 | '</a>', |
||
| 73 | '<a href="' . $old_url . '">' . $old_url . '</a>' |
||
| 74 | ), 'jetpack' |
||
| 75 | ) |
||
| 76 | ?> |
||
| 77 | </div> |
||
| 78 | <div style="width: 49%; display: inline-block;"> |
||
| 79 | <?php |
||
| 80 | _e( |
||
| 81 | sprintf( |
||
| 82 | 'Is this website a temporaray duplicate of %s for the purposes of testing, staging or development? |
||
| 83 | If so, we recommend keeping it in Safe Mode.', |
||
| 84 | '<a href="' . $old_url . '">' . $old_url . '</a>' |
||
| 85 | ), 'jetpack' |
||
| 86 | ); |
||
| 87 | ?> |
||
| 88 | <button id="idc-confirm-safe-mode"><?php _e( 'Confirm Safe Mode' ); ?></button> |
||
| 89 | </div> |
||
| 90 | <div style="width: 49%; display: inline-block;"> |
||
| 91 | <?php |
||
| 92 | _e( |
||
| 93 | sprintf( |
||
| 94 | 'If this is a separate and new website, or the new home of %s, we recommend turning Safe Mode off, |
||
| 95 | and re-establishing your connection to WordPress.com.', |
||
| 96 | '<a href="' . $old_url . '">' . $old_url . '</a>' |
||
| 97 | ), 'jetpack' |
||
| 98 | ); |
||
| 99 | ?> |
||
| 100 | <button id="idc-fix-connection"><?php _e( "Fix Jetpack's Connection" ); ?></button> |
||
| 101 | </div> |
||
| 102 | </div> |
||
| 103 | <?php } |
||
| 104 | |||
| 136 |
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.