| Conditions | 13 |
| Paths | 256 |
| Total Lines | 122 |
| 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 |
||
| 27 | function page_render() { |
||
| 28 | $list_table = new Jetpack_Modules_List_Table; |
||
| 29 | |||
| 30 | // We have static.html so let's continue trying to fetch the others |
||
| 31 | $noscript_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-noscript-notice.html' ); |
||
| 32 | $version_notice = $rest_api_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-version-notice.html' ); |
||
| 33 | $ie_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-ie-notice.html' ); |
||
| 34 | |||
| 35 | $noscript_notice = str_replace( |
||
| 36 | '#HEADER_TEXT#', |
||
| 37 | esc_html__( 'You have JavaScript disabled', 'jetpack' ), |
||
| 38 | $noscript_notice |
||
| 39 | ); |
||
| 40 | $noscript_notice = str_replace( |
||
| 41 | '#TEXT#', |
||
| 42 | esc_html__( "Turn on JavaScript to unlock Jetpack's full potential!", 'jetpack' ), |
||
| 43 | $noscript_notice |
||
| 44 | ); |
||
| 45 | |||
| 46 | $version_notice = str_replace( |
||
| 47 | '#HEADER_TEXT#', |
||
| 48 | esc_html__( 'You are using an outdated version of WordPress', 'jetpack' ), |
||
| 49 | $version_notice |
||
| 50 | ); |
||
| 51 | $version_notice = str_replace( |
||
| 52 | '#TEXT#', |
||
| 53 | esc_html__( "Update WordPress to unlock Jetpack's full potential!", 'jetpack' ), |
||
| 54 | $version_notice |
||
| 55 | ); |
||
| 56 | |||
| 57 | $rest_api_notice = str_replace( |
||
| 58 | '#HEADER_TEXT#', |
||
| 59 | esc_html( __( 'WordPress REST API is disabled', 'jetpack' ) ), |
||
| 60 | $rest_api_notice |
||
| 61 | ); |
||
| 62 | $rest_api_notice = str_replace( |
||
| 63 | '#TEXT#', |
||
| 64 | esc_html( __( "Enable WordPress REST API to unlock Jetpack's full potential!", 'jetpack' ) ), |
||
| 65 | $rest_api_notice |
||
| 66 | ); |
||
| 67 | |||
| 68 | $ie_notice = str_replace( |
||
| 69 | '#HEADER_TEXT#', |
||
| 70 | esc_html__( 'You are using an unsupported browser version.', 'jetpack' ), |
||
| 71 | $ie_notice |
||
| 72 | ); |
||
| 73 | $ie_notice = str_replace( |
||
| 74 | '#TEXT#', |
||
| 75 | esc_html__( "Update your browser to unlock Jetpack's full potential!", 'jetpack' ), |
||
| 76 | $ie_notice |
||
| 77 | ); |
||
| 78 | |||
| 79 | if ( $this->is_wp_version_too_old() ) { |
||
| 80 | echo $version_notice; |
||
| 81 | } |
||
| 82 | if ( ! $this->is_rest_api_enabled() ) { |
||
| 83 | echo $rest_api_notice; |
||
| 84 | } |
||
| 85 | echo $noscript_notice; |
||
| 86 | echo $ie_notice; |
||
| 87 | ?> |
||
| 88 | |||
| 89 | <div class="page-content configure"> |
||
| 90 | <div class="frame top hide-if-no-js"> |
||
| 91 | <div class="wrap"> |
||
| 92 | <div class="manage-left"> |
||
| 93 | <table class="table table-bordered fixed-top"> |
||
| 94 | <thead> |
||
| 95 | <tr> |
||
| 96 | <th class="check-column"><input type="checkbox" class="checkall"></th> |
||
| 97 | <th colspan="2"> |
||
| 98 | <?php $list_table->unprotected_display_tablenav( 'top' ); ?> |
||
| 99 | <span class="filter-search"> |
||
| 100 | <button type="button" class="button">Filter</button> |
||
| 101 | </span> |
||
| 102 | </th> |
||
| 103 | </tr> |
||
| 104 | </thead> |
||
| 105 | </table> |
||
| 106 | </div> |
||
| 107 | </div><!-- /.wrap --> |
||
| 108 | </div><!-- /.frame --> |
||
| 109 | <div class="frame bottom"> |
||
| 110 | <div class="wrap"> |
||
| 111 | <div class="manage-right" style="display: none;"> |
||
| 112 | <div class="bumper"> |
||
| 113 | <form class="navbar-form" role="search"> |
||
| 114 | <input type="hidden" name="page" value="jetpack_modules" /> |
||
| 115 | <?php $list_table->search_box( __( 'Search', 'jetpack' ), 'srch-term' ); ?> |
||
| 116 | <p><?php esc_html_e( 'View:', 'jetpack' ); ?></p> |
||
| 117 | <div class="button-group filter-active"> |
||
| 118 | <button type="button" class="button <?php if ( empty( $_GET['activated'] ) ) echo 'active'; ?>"><?php esc_html_e( 'All', 'jetpack' ); ?></button> |
||
| 119 | <button type="button" class="button <?php if ( ! empty( $_GET['activated'] ) && 'true' == $_GET['activated'] ) echo 'active'; ?>" data-filter-by="activated" data-filter-value="true"><?php esc_html_e( 'Active', 'jetpack' ); ?></button> |
||
| 120 | <button type="button" class="button <?php if ( ! empty( $_GET['activated'] ) && 'false' == $_GET['activated'] ) echo 'active'; ?>" data-filter-by="activated" data-filter-value="false"><?php esc_html_e( 'Inactive', 'jetpack' ); ?></button> |
||
| 121 | </div> |
||
| 122 | <p><?php esc_html_e( 'Sort by:', 'jetpack' ); ?></p> |
||
| 123 | <div class="button-group sort"> |
||
| 124 | <button type="button" class="button <?php if ( empty( $_GET['sort_by'] ) ) echo 'active'; ?>" data-sort-by="name"><?php esc_html_e( 'Alphabetical', 'jetpack' ); ?></button> |
||
| 125 | <button type="button" class="button <?php if ( ! empty( $_GET['sort_by'] ) && 'introduced' == $_GET['sort_by'] ) echo 'active'; ?>" data-sort-by="introduced" data-sort-order="reverse"><?php esc_html_e( 'Newest', 'jetpack' ); ?></button> |
||
| 126 | <button type="button" class="button <?php if ( ! empty( $_GET['sort_by'] ) && 'sort' == $_GET['sort_by'] ) echo 'active'; ?>" data-sort-by="sort"><?php esc_html_e( 'Popular', 'jetpack' ); ?></button> |
||
| 127 | </div> |
||
| 128 | <p><?php esc_html_e( 'Show:', 'jetpack' ); ?></p> |
||
| 129 | <?php $list_table->views(); ?> |
||
| 130 | </form> |
||
| 131 | </div> |
||
| 132 | </div> |
||
| 133 | <div class="manage-left" style="width: 100%;"> |
||
| 134 | <form class="jetpack-modules-list-table-form" onsubmit="return false;"> |
||
| 135 | <table class="<?php echo implode( ' ', $list_table->get_table_classes() ); ?>"> |
||
| 136 | <tbody id="the-list"> |
||
| 137 | <?php $list_table->display_rows_or_placeholder(); ?> |
||
| 138 | </tbody> |
||
| 139 | </table> |
||
| 140 | </form> |
||
| 141 | </div> |
||
| 142 | </div><!-- /.wrap --> |
||
| 143 | </div><!-- /.frame --> |
||
| 144 | </div><!-- /.content --> |
||
| 145 | <?php |
||
| 146 | |||
| 147 | JetpackTracking::record_user_event( 'wpa_page_view', array( 'path' => 'old_settings' ) ); |
||
| 148 | } |
||
| 149 | |||
| 169 |