| Conditions | 1 |
| Paths | 1 |
| Total Lines | 73 |
| 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 |
||
| 94 | public function get_settings() { |
||
| 95 | return apply_filters( |
||
| 96 | 'alnp_misc_settings', array( |
||
| 97 | |||
| 98 | 'title' => array( |
||
| 99 | 'title' => $this->label, |
||
| 100 | 'type' => 'title', |
||
| 101 | 'desc' => esc_html__( 'Further optional options can be found here should you want to use or need.', 'auto-load-next-post' ), |
||
| 102 | 'id' => 'misc_options' |
||
| 103 | ), |
||
| 104 | |||
| 105 | 'remove_comments' => array( |
||
| 106 | 'title' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
||
| 107 | 'desc' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
||
| 108 | 'id' => 'auto_load_next_post_remove_comments', |
||
| 109 | 'default' => 'yes', |
||
| 110 | 'type' => 'checkbox', |
||
| 111 | 'autoload' => false |
||
| 112 | ), |
||
| 113 | |||
| 114 | 'google_analytics' => array( |
||
| 115 | 'title' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
||
| 116 | 'desc' => esc_html__( 'Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post' ), |
||
| 117 | 'id' => 'auto_load_next_post_google_analytics', |
||
| 118 | 'default' => 'no', |
||
| 119 | 'type' => 'checkbox', |
||
| 120 | 'autoload' => false |
||
| 121 | ), |
||
| 122 | |||
| 123 | 'load_js_in_footer' => array( |
||
| 124 | 'title' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
||
| 125 | 'desc' => sprintf( esc_html__( 'Enable to load %s in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
||
| 126 | 'id' => 'auto_load_next_post_load_js_in_footer', |
||
| 127 | 'default' => 'no', |
||
| 128 | 'type' => 'checkbox', |
||
| 129 | 'autoload' => false |
||
| 130 | ), |
||
| 131 | |||
| 132 | 'disable_on_mobile' => array( |
||
| 133 | 'title' => esc_html__( 'Disable for Mobile?', 'auto-load-next-post' ), |
||
| 134 | 'desc' => sprintf( esc_html__( 'Enable to disable %s from running on mobile devices.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
||
| 135 | 'id' => 'auto_load_next_post_disable_on_mobile', |
||
| 136 | 'default' => 'no', |
||
| 137 | 'type' => 'checkbox', |
||
| 138 | 'autoload' => false |
||
| 139 | ), |
||
| 140 | |||
| 141 | 'reset_data' => array( |
||
| 142 | 'title' => esc_html__( 'Reset all data?', 'auto-load-next-post' ), |
||
| 143 | 'desc' => esc_html__( 'Press the reset button to clear all settings for this plugin and re-initialize.', 'auto-load-next-post' ), |
||
| 144 | 'id' => 'auto_load_next_post_reset_data', |
||
| 145 | 'class' => 'reset-settings', |
||
| 146 | 'value' => esc_html__( 'Reset', 'auto-load-next-post' ), |
||
| 147 | 'url' => add_query_arg( array( 'page' => 'auto-load-next-post', 'view' => esc_attr( $this->id ), 'reset-alnp' => 'yes' ), admin_url( 'options-general.php' ) ), |
||
| 148 | 'type' => 'button' |
||
| 149 | ), |
||
| 150 | |||
| 151 | 'uninstall' => array( |
||
| 152 | 'title' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
||
| 153 | 'desc' => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
||
| 154 | 'id' => 'auto_load_next_post_uninstall_data', |
||
| 155 | 'default' => 'no', |
||
| 156 | 'type' => 'checkbox', |
||
| 157 | 'autoload' => false |
||
| 158 | ), |
||
| 159 | |||
| 160 | 'section_end' => array( |
||
| 161 | 'type' => 'sectionend', |
||
| 162 | 'id' => 'misc_options' |
||
| 163 | ), |
||
| 164 | ) |
||
| 165 | ); // End misc settings |
||
| 166 | } // END get_settings() |
||
| 167 | |||
| 197 |