| Conditions | 31 |
| Paths | 80 |
| Total Lines | 139 |
| Code Lines | 112 |
| 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 namespace EmailLog\Core\UI\Page; |
||
| 126 | public function render_page() { |
||
| 127 | global $wpdb; |
||
| 128 | ?> |
||
| 129 | <div class="updated"> |
||
| 130 | <p><strong><?php echo $this->messages['info_message']; ?></strong></p> |
||
| 131 | </div> |
||
| 132 | |||
| 133 | <?php if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) { ?> |
||
| 134 | <div class="notice notice-warning"> |
||
| 135 | <p><strong> |
||
| 136 | <?php printf( __( 'SAVEQUERIES is <a href="%s" target="_blank">enabled</a>. This puts additional load on the memory and will restrict the number of items that can be deleted.', 'bulk-delete' ), 'https://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis' ); ?> |
||
| 137 | </strong></p> |
||
| 138 | </div> |
||
| 139 | <?php } ?> |
||
| 140 | |||
| 141 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { ?> |
||
| 142 | <div class="notice notice-warning"> |
||
| 143 | <p><strong> |
||
| 144 | <?php printf( __( 'DISABLE_WP_CRON is <a href="%s" target="_blank">enabled</a>. This prevents scheduler from running.', 'bulk-delete' ), 'https://codex.wordpress.org/Editing_wp-config.php#Disable_Cron_and_Cron_Timeout' ); ?> |
||
| 145 | </strong></p> |
||
| 146 | </div> |
||
| 147 | <?php } ?> |
||
| 148 | <div class="wrap"> |
||
| 149 | <h1><?php _e( 'Email Log - System Info', 'email-log' ); ?></h1> |
||
| 150 | |||
| 151 | <textarea wrap="off" style="width:100%;height:500px;font-family:Menlo,Monaco,monospace;white-space:pre;" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="email-log-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'bulk-delete' ); ?>"> |
||
| 152 | ### Begin System Info ### |
||
| 153 | <?php |
||
| 154 | /** |
||
| 155 | * Runs before displaying system info. |
||
| 156 | * |
||
| 157 | * This action is primarily for adding extra content in System Info. |
||
| 158 | */ |
||
| 159 | do_action( 'el_system_info_before' ); |
||
| 160 | ?> |
||
| 161 | |||
| 162 | Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
||
| 163 | |||
| 164 | SITE_URL: <?php echo site_url() . "\n"; ?> |
||
| 165 | HOME_URL: <?php echo home_url() . "\n"; ?> |
||
| 166 | Browser: <?php echo esc_html( $_SERVER['HTTP_USER_AGENT'] ), "\n"; ?> |
||
| 167 | |||
| 168 | Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?> |
||
| 169 | Active Theme: <?php echo $this->el_get_current_theme_name() . "\n"; ?> |
||
| 170 | <?php |
||
| 171 | $host = $this->el_identify_host(); |
||
| 172 | if ( '' !== $host ) : ?> |
||
| 173 | Host: <?php echo $host . "\n\n"; ?> |
||
| 174 | <?php endif; ?> |
||
| 175 | |||
| 176 | <?php $post_types = get_post_types(); ?> |
||
| 177 | Registered Post types: <?php echo implode( ', ', $post_types ) . "\n"; ?> |
||
| 178 | <?php |
||
| 179 | foreach ( $post_types as $post_type ) { |
||
| 180 | echo $post_type; |
||
| 181 | if ( strlen( $post_type ) < 26 ) { |
||
| 182 | echo str_repeat( ' ', 26 - strlen( $post_type ) ); |
||
| 183 | } |
||
| 184 | $post_count = wp_count_posts( $post_type ); |
||
| 185 | foreach ( $post_count as $key => $value ) { |
||
| 186 | echo $key, '=', $value, ', '; |
||
| 187 | } |
||
| 188 | echo "\n"; |
||
| 189 | } |
||
| 190 | ?> |
||
| 191 | |||
| 192 | <?php $taxonomies = get_taxonomies(); ?> |
||
| 193 | Registered Taxonomies: <?php echo implode( ', ', $taxonomies ) . "\n"; ?> |
||
| 194 | |||
| 195 | Email log Version: <?php $this->el_plugin_version() . "\n"; ?> |
||
| 196 | WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
||
| 197 | PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
||
| 198 | MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
||
| 199 | Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
||
| 200 | |||
| 201 | WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
||
| 202 | WordPress Max Limit: <?php echo WP_MAX_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
||
| 203 | PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
||
| 204 | |||
| 205 | SAVEQUERIES: <?php echo defined( 'SAVEQUERIES' ) ? SAVEQUERIES ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
||
| 206 | WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
||
| 207 | WP_SCRIPT_DEBUG: <?php echo defined( 'WP_SCRIPT_DEBUG' ) ? WP_SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
||
| 208 | |||
| 209 | GMT Offset: <?php echo esc_html( get_option( 'gmt_offset' ) ), "\n\n"; ?> |
||
| 210 | DISABLE_WP_CRON: <?php echo defined( 'DISABLE_WP_CRON' ) ? DISABLE_WP_CRON ? 'Yes' . "\n" : 'No' . "\n" : 'Not set' . "\n" ?> |
||
| 211 | WP_CRON_LOCK_TIMEOUT: <?php echo defined( 'WP_CRON_LOCK_TIMEOUT' ) ? WP_CRON_LOCK_TIMEOUT : 'Not set', "\n" ?> |
||
| 212 | EMPTY_TRASH_DAYS: <?php echo defined( 'EMPTY_TRASH_DAYS' ) ? EMPTY_TRASH_DAYS : 'Not set', "\n" ?> |
||
| 213 | |||
| 214 | PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? 'Yes' : 'No', "\n"; // phpcs:ignore PHPCompatibility.PHP.DeprecatedIniDirectives.safe_modeDeprecatedRemoved?> |
||
| 215 | PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
||
| 216 | PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
||
| 217 | PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?> |
||
| 218 | PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
||
| 219 | PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; // phpcs:ignore PHPCompatibility.PHP.NewIniDirectives.max_input_varsFound?> |
||
| 220 | PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?> |
||
| 221 | PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? 'Yes' : 'No', "\n"; ?> |
||
| 222 | |||
| 223 | WP Table Prefix: <?php echo $wpdb->prefix, "\n";?> |
||
| 224 | |||
| 225 | Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
||
| 226 | Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
||
| 227 | Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
||
| 228 | Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
||
| 229 | Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
||
| 230 | Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
||
| 231 | |||
| 232 | DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
||
| 233 | FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?> |
||
| 234 | cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?> |
||
| 235 | SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?> |
||
| 236 | SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?> |
||
| 237 | |||
| 238 | ACTIVE PLUGINS: |
||
| 239 | |||
| 240 | <?php $this->el_print_current_plugins(); ?> |
||
| 241 | |||
| 242 | <?php |
||
| 243 | if ( is_multisite() ) : ?> |
||
| 244 | NETWORK ACTIVE PLUGINS: |
||
| 245 | |||
| 246 | <?php |
||
| 247 | $this->el_print_network_active_plugins(); |
||
| 248 | endif; |
||
| 249 | ?> |
||
| 250 | |||
| 251 | <?php do_action( 'el_system_info_after' );?> |
||
| 252 | ### End System Info ###</textarea> |
||
| 253 | |||
| 254 | <p class="submit"> |
||
| 255 | <input type="hidden" name="el_action" value="download_sysinfo"> |
||
| 256 | <?php submit_button( 'Download System Info File', 'primary', 'email-log-sysinfo', false ); ?> |
||
| 257 | </p> |
||
| 258 | |||
| 259 | |||
| 260 | </div> |
||
| 261 | <?php |
||
| 262 | |||
| 263 | $this->render_page_footer(); |
||
| 264 | } |
||
| 265 | |||
| 280 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: