| Conditions | 4 |
| Paths | 6 |
| Total Lines | 58 |
| 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 |
||
| 72 | function user_profile() { |
||
| 73 | $blog_name = get_bloginfo( 'blogname' ); |
||
| 74 | if ( empty( $blog_name ) ) { |
||
| 75 | $blog_name = home_url( '/' ); |
||
| 76 | } |
||
| 77 | |||
| 78 | ?> |
||
| 79 | <div id="post-by-email" class="jetpack-targetable"> |
||
| 80 | <h3><?php esc_html_e( 'Post by Email', 'jetpack' ); ?></h3> |
||
| 81 | <table class="form-table"> |
||
| 82 | <tr> |
||
| 83 | <th scope="row"><?php esc_html_e( 'Email Address', 'jetpack' ); ?><span id="jp-pbe-spinner" class="spinner"></span></th> |
||
| 84 | <td> |
||
| 85 | <div id="jp-pbe-error" class="jetpack-inline-error"></div> <?php |
||
| 86 | |||
| 87 | if ( $this->check_user_connection() ) { |
||
| 88 | $email = $this->get_post_by_email_address(); |
||
| 89 | |||
| 90 | if ( empty( $email ) ) { |
||
| 91 | $enable_hidden = ''; |
||
| 92 | $info_hidden = ' style="display: none;"'; |
||
| 93 | } else { |
||
| 94 | $enable_hidden = ' style="display: none;"'; |
||
| 95 | $info_hidden = ''; |
||
| 96 | } ?> |
||
| 97 | |||
| 98 | <input type="button" name="jp-pbe-enable" id="jp-pbe-enable" class="button" value="<?php esc_attr_e( 'Enable Post By Email', 'jetpack' ); ?> "<?php echo $enable_hidden; ?> /> |
||
| 99 | <div id="jp-pbe-info"<?php echo $info_hidden; ?>> |
||
| 100 | <p id="jp-pbe-email-wrapper"> |
||
| 101 | <input type="text" id="jp-pbe-email" value="<?php echo esc_attr( $email ); ?>" readonly="readonly" class="regular-text" /> |
||
| 102 | <span class="description"><a target="_blank" href="http://jetpack.com/support/post-by-email/"><?php esc_html_e( 'More information', 'jetpack' ); ?></a></span> |
||
| 103 | </p> |
||
| 104 | <p> |
||
| 105 | <input type="button" name="jp-pbe-regenerate" id="jp-pbe-regenerate" class="button" value="<?php esc_attr_e( 'Regenerate Address', 'jetpack' ); ?> " /> |
||
| 106 | <input type="button" name="jp-pbe-disable" id="jp-pbe-disable" class="button" value="<?php esc_attr_e( 'Disable Post By Email', 'jetpack' ); ?> " /> |
||
| 107 | </p> |
||
| 108 | </div> <?php |
||
| 109 | } else { |
||
| 110 | $jetpack = Jetpack::init(); ?> |
||
| 111 | |||
| 112 | <p class="jetpack-inline-message"> |
||
| 113 | <?php printf( |
||
| 114 | esc_html( wptexturize( __( 'To use Post By Email, you need to link your %s account to your WordPress.com account.', 'jetpack' ) ) ), |
||
| 115 | '<strong>' . esc_html( $blog_name ) . '</strong>' |
||
| 116 | ); ?><br /> |
||
| 117 | <?php echo esc_html( wptexturize( __( "If you don't have a WordPress.com account yet, you can sign up for free in just a few seconds.", 'jetpack' ) ) ); ?> |
||
| 118 | </p> |
||
| 119 | <p> |
||
| 120 | <a href="<?php echo $jetpack->build_connect_url( false, get_edit_profile_url( get_current_user_id() ) . '#post-by-email', 'unlinked-user-pbe' ); ?>" class="button button-connector" id="wpcom-connect"><?php esc_html_e( 'Link account with WordPress.com', 'jetpack' ); ?></a> |
||
| 121 | </p> |
||
| 122 | <?php |
||
| 123 | } ?> |
||
| 124 | </td> |
||
| 125 | </tr> |
||
| 126 | </table> |
||
| 127 | </div> |
||
| 128 | <?php |
||
| 129 | } |
||
| 130 | |||
| 203 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.